## rest – RestAPI different json for list of items and item details

I have a RestAPI with two endpoints:
/items – list of items
/items/2 – selected by id, an item details

returned json for list of items is

{ “id”: “1”, “name”: “Max” }

returned json for item details

{ “id”: “1”, “name”: “Max”, “age”: 30 }

What are pro & cons (from client perspective) for mapping the data to:

• two different models ItemList and ItemDetails
• single model but fields for item details are optionals
• model with inheritance: Item and ItemDetails inherits from Item

## paragraphs – Drupal 8 rest api – approaches for multi-field values

I am using the Drupal 8 rest api to post content to a custom content type. I have a use case in which I need to post multiple values to a single mutli-value field. If someone can show me how to do this it would negate my question.

As an alternative, I believe I could use the paragraphs module to create a fieldset within my content type. I am writing to ask if someone can give me an example of how to post (or patch) my multiple values to the paragraph fieldset.

I should add that I do not know in advance how many values I will have in my multi-value dataset; it will vary by node. Its for that reason that I think either a multi-value field or a paragraphs fieldset might suit better than just creating additional fields in the content type.

## REST or any other API for client side dev to get current users running workflows(Designer or OOTB or MS Flow)?

As part of a requirement the clients would want us to create an SPFX webpart which displays all the document names and the tasks or workflows running on it for that user/current User. Is there a way in Client side with which i can get this detail? This has to be all the workflows running for current user.
Any help would be greatly appreciated.

## How to get Product Custom attribute Using REST API in magento2.3.4

Hello I call the below API to get Product information

Url: `URL: http://localhost/magentosample230/rest/V1/products/24-MB04`

Type: `GET`

I got the Follow out put:

``````{
"attribute_code": "material",
"value": "5459,5460,5463,5465"
}
``````

But i want following output:

``````{
"attribute_code": "material",
"value": "Canvas,Cotton,Mesh,Polyester"
}
``````

If someone help me its helpful

## plugins – Endpoint rest api and wordpress

I am building a website where there is a frontend developed in React and a backend deployed on an AWS using WordPress.

The goal is to use WordPress as a backend with woocommerce and have the website in react able to login/register, create a product,… send all request to WordPress.

First any advises on how to achieve this endpoints needs ? I tried JWT token for authentication but it seems not trivial to access to endpoint or even create my own. Can I create my own endpoint knowing that most of the time it will be request to database.

Can I create my own DBs and being able to access them through endpoints.

Is there any WP plugins to help me to achieve this in terms of endpoints ? Free ?

## magento2 – How can I get product image from REST API as HTTPS

I use `V1/getproductimage/<sku>` and get product’s image url from API. It returns

``````[
{
"product_image_url": "http://<host>/pub/media/catalog/product/cache/36e9cda53c678653975daba9a022fb1d/<media file>"
}
]
``````

I’m developing LINE chatbot, It need HTTPS URL to be action in LINE FLEX. So, I want to know how can I get product image from REST API as HTTPS. Thank you in advance.

## Use a Tree Diagram

Because I am bad at remembering formulas and bad at probabilities in general I like to use a tree diagram. The other answers provide good straight forward solutions you can apply but I hope to show why those methods work.

If we roll a d20 4 times, the tree will have four levels with two branches at each level: You either roll a 7 or higher, or you don’t. At each branch we assign a probability for that individual outcome: in this case, a 6/20 for rolling a 1-6, and a 14/20 for rolling a 7-20. In this diagram I haven’t filled out the branches where we roll a 1-6 because they’re not relevant for this question.

To calculate the final probability, we need each roll to result in a 7-20. For this, we take the probability of each branch and multiply them together, so we get

$$frac{14}{20} cdot frac{14}{20} cdot frac{14}{20} cdot frac{14}{20} = left(frac{14}{20}right)^4 approx 24%$$

For 15 or higher in this case, we can substitute 14/20 for 6/20 and hence get
$$frac{6}{20} cdot frac{6}{20} cdot frac{6}{20} cdot frac{6}{20} = left(frac{6}{20}right)^4 approx 0.8%$$

Similarly if we were to look at 3 dice rolls instead, the tree would only have 3 levels, and hence we would only end up multiplying the probability 3 times, so we would get

$$frac{14}{20} cdot frac{14}{20} cdot frac{14}{20} = left(frac{14}{20}right)^3 approx 34%$$

Now if we were interested in finding the probability of getting 7 if we took the highest roll each time we would have to consider the likelihood of getting a 7-20 once anywhere in the tree, not just the branch where we get it 4 times in a row, which would be more complex. Luckily there’s a trick for these kinds of situations: Instead of considering the probability of getting at least 1 7-20 in 4 rolls, we can consider the probability of never getting a 7-20 in 4 rolls and our result will be 1 minus that probability.

So to do that we must first find the likelihood of getting a 1-6 4 times in a row, and we would see that it is as above

$$frac{6}{20} cdot frac{6}{20} cdot frac{6}{20} cdot frac{6}{20} = left(frac{6}{20}right)^4 approx 0.8%$$

Therefore we must take 1 (or 100%) and subtract the probability we found which gives us a 99.2% chance of rolling at least a 7 in 4 rolls. Likewise for 3 rolls we get 97.3%

## statistics – A player rolls four 20-sided dice, takes the lowest value, ignores the rest. What is the probability of this value at least 7?

I’m designing a tabletop game, and I need to figure out how to calculate a few probabilities:

1. Roll 3 20-sided dice, take the highest value. What is the probability of it being 7 or higher? 15 or higher?
1. Roll 4 20-sided dice, take the highest value. What is the probability of it being 7 or higher? 15 or higher?
1. Roll 3 20-sided dice, take the lowest value. What is the probability of it being 7 or higher? 15 or higher?
1. Roll 4 20-sided dice, take the lowest value. What is the probability of it being 7 or higher? 15 or higher?

How can I do this? Could you explain to me how this works, or even better – give me a simple formula?

## dnd 5e – Does a rest remove ALL chase-induced exhaustion or just ONE level?

Most exhaustion can be removed by a long rest, food, and drink (PHB 251)

Finishing a long rest reduces a creature’s exhaustion level by 1, provided that creature has also ingested some food and drink.

Exhaustion caused by dashing while in a chase, however, is removed by a short OR long rest, with nothing else required. (DMG 252)

A creature can remove the levels of exhaustion it gained during the chase by finishing a short or long rest.

I understand that a short rest alone can remove chase exhaustion.

What I don’t understand is whether one rest removes multiple levels of exhaustion or just one. That is, is the second quote above more explicitly written as:

1. A creature can remove ALL the LEVELS of exhaustion it gained during the chase by finishing a SINGLE short or long rest.

(or)

1. A creature can remove ONE of the LEVELS of exhaustion it gained during the chase for EACH short or long rest that it finishes.

## SP Online generate refresh token for testing REST api calls in Posman

I’m refining SPO api calls intended for a mobile app project using Postman, and all is fine except the access token keeps expiring after maybe a day. How do I get the “refresh token” to work so I don’t have to generate a new token each day? I tried adding enable_auto_refresh_access_token = true in the token POST call, but I’ve no idea if that’s what’s required.