Allow Prompt tag value to be used as input to JSONPath in Response tag #8566
Replies: 1 comment
-
|
Hi, Thanks for explaining your use case. At the moment, JSONPath in response tags needs to be static, so dynamically passing a index isn't supported. As an alternative, you can use a prompt tag directly in your request url, for example - This allows you to quickly enter the required id at runtime without modifying the request each time. A feature request has been raised to support dynamic values within response tag JSONPath in insomnia. Thank you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I quite often get arrays of objects back from a REST API, and want to call another endpoint using the 'id' field in one of the array entries in the path of the new API. Currently, I either have to use a Prompt tag to enter the 'id' (copied from the response) or I use a Response tag to extract the ID from one of the array entries, e.g. using "$[0].id". If I want to change to another element of the array, I need to edit the Response tag JSONPath, e.g. to "$[1].id".
What I would like is to be able to prompt for the array index (e.g. 0 or 1 in my example) and use that value in the JSONPath of the Response tag. Or any other solution that might also accomplish my aim.
Beta Was this translation helpful? Give feedback.
All reactions