[FEATURE REQUEST] JSONPath/XPath access to Environment Variables
See original GitHub issue[Feature Request]
Would like to ability to use specific workspace environment variables in the JSONPath queries.
Currently we querying API with specific order numbers and am getting back very large JSON response for customer. Would like to filter the JSONPath filter using the variable that is set on the GET API request.
This would also be valuable for those that are constantly running the same JSONPath queries for that specific environment - for example if you are always running $..[?(@.customer == '50')]
to filter out the information for just that environment (per call) so that you can have set environment variables you can use for JSON responses that are returned on an environment basis.
The data may change, which is why it would be nice to parse out specific environment variables that you can throw into the JSONPath query section. The history is very useful, but if the query is long enough, it is a lot easier to use specific variables (such as CustomerID, FQDNs, etc) to add into the JSONPath query.
–>
- Insomnia Version: Version 6.6.2 (6.6.2.2932)
- Operating System: macOSMojave version 10.14.16
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
I like the idea of supporting environment variables in as many places as possible. Using them in JSONPath for the response makes sense I think.
There are three places JSONPath filters can be used, however, and one of them would be much more difficult to enable variable support.
The implementation for No. 1 would be fairly trivial and would probably cover most use cases. Is this where you are looking to use it? If so, I could hook this up in just a few minutes as we just need to render the filter string before passing it into the filter library.
@gschier – would really liked to get an update on this feature. would be really helpful when I need to pass in Environment Variables for the response filters.