I setup a Mock Server, its dedicated environment, the matching collection with some requests and related examples. Everything works fine.
I am however stuck in mocking a very simple and common use case. I need to use the a value passed in the request URL path (not the querystring) to customize the response body.
Letโs take for instance the URL www.mock.com/orders/:id where id is a variable parameter that represent a specific order. For instance for order with id equal to 3, the URL representing the resource is www.mock.com/orders/3.
I would like to have in the response body, for any GET to www.mock.com/orders/:id, the exact same response but the id:
{
"id": {{id}},
"number": 456,
"status": 1,
"orderLines": [....]
}
I couldโve used the Pre-Request script in order to get the parameter and update the collection/environment variable but this feature (I donโt really know why) is not available anymore in the examples.
How could I achieve it?
Details (like screenshots):