Introdução do suporte a jsonpath e jmespath!
We are thrilled to announce an update to one of our key Skillset Actions: the fetch action! In addition to existing functionality, the fetch now supports two new parameters, namely jsonpath and jmespath. This impressive enhancement allows you to extract specific sections from a JSON document returned by your fetch action.
The jsonpath parameter allows you to apply a JSONPath expression to determine the data you wish to extract from the document. JMESPath, on the other hand, provides a query language for JSON, allowing you to extract and transform elements from a JSON document. The usage of these parameters is straightforward. They need to be added right after the fetch action name, similar to how you would use other parameters.
Here are a few examples of how the fetch action can be utilized with the new parameters. For instance, if you want to extract data using JSONPath, you would use it in this manner:
```fetch/jsonpath=$..book[?(@.price<10)] POST https://some/url HTTP/1.1 Content-Type: application/json {"param": "value"} ```
The above code fetches data from the specified URL and returns all books that cost less than 10 units.
For JMESPath, you would use it as follows:
```fetch/jmespath=locations[*].name POST https://another/url HTTP/1.1 Content-Type: application/json {"anotherParam": "anotherValue"} ```
In the above code, the fetch action will retrieve data from the provided URL and return the names of all the locations only.
By introducing these new features, we expect to give you even more power and flexibility in optimizing your bot's fetch action. Try them out today and let us know your thoughts! As always, we continue to welcome your feedback to continually improve and enhance our tools and services.