I have a mock server that successfully follows this request body and response body pattern:
REQUEST:
{
"products": [
{
"inventoryAction": "string",
"inventoryType": "string",
"productId": "55",
"storeId": "int"
}
]
}
RESPONSE:
{
"errorMessage": "string",
"inventory": [
{
"inventoryType": "Available",
"productId": {{ $body 'products.productId' 'DEFAULT' }}
"quantity": 0,
"storeId": "int"
}
]
}```
Now my only question is, how do I get `productId` to reply 55? It keeps erroring out and replying `DEFAULT` I am familiar with dynamic response as per the documentation here:
https://learning.postman.com/docs/designing-and-developing-your-api/mocking-data/creating-dynamic-responses/#using-template-helpers
How do I write the `path.to.variable` part for a value within an array?
If the array was not there, I know how to structure the path, but the array is throwing me off.
I have looked through here as well, still no luck:
https://www.npmjs.com/package/object-path
Many thanks in advance!
J