[ { "userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit" },
{
"userId": 1,
"id": 2,
"title": "qui est esse",
"body": "est rerum tempore vitae\nsequi sint "
}]
So, as you can see, there are multiple objects,. However, the error message I always get from PureCloud is:
{
"status": 400,
"code": "invalid.extraction.into.translation.map",
"message": "There was an issue extracting a value from the remote endpoint's response into the response translation map. Cause: Expected to find an object with property ['id'] in path $ but found 'java.util.ArrayList'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.",
"messageParams": {},
"contextId": "65e04558-8c48-43ef-b281-5b15e70e6f93",
"details": [],
"errors": []
}
On other hand, when I work only with single object, in which the response does not start with "[", it works successfully.
As a note on the "invalid.extraction.into.translation.map" error that you are getting. I highly recommend grabbing the results you are getting from the execution and pasting those into a site like http://jsonpath.com/ and working through the JSONPath that you are using to populate the translation map.
This isn't a site we have any affiliation with, so I would definitely redact anything sensitive.
As an example, if you wanted to get an array of all of the titles you could use this for your JSONPath
Thank you very much for the feedback.
I have more questions related to popup scripts.
How I could display all the objects in the array on Pop-up Scripts? Is there a loop statement in the popup script that I can use?
I would like to GET these objects, and these will be displayed for Agents as a down-list/ checkbox / ets, for further process!!
I'm not as familiar with scripts, but I don't believe adding UI components dynamically, such as in a loop, is possible. I have seen scripts were up to 'x' fields are pre-allocated, maybe 5, where some get used and some are left blank.
Thank you Smith,
This is what I am aware of. I don't think script support loops. However, I will try your idea of setting a fixed number of fields to deal with the recent, for now.