Hi Team,
I am trying to make a REST call using Call studio REST Client to an endpoint. However, in my json response, i get multiple values.
Although, i could see all the responses in the log, my requirement is to utilize only 1 response.
As per documentation, it looks like i can achieve the same outcome using json expression but it doesnt work.
Example my response id looks like this:
{
"item": {
"id": 123,
"url": "https://{subdomain}.zendesk.com/api/v2/items/123.json",
"name": "Wibble",
...
"created_at": "2012-04-04T09:14:57Z"
}
}
Now, i just need to store value of id in one of the session data. However, current response_body stores the entire response.
My xpath/json path looks like this : /item/id
Please help.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set your path to $.item. and you should then be able to reference the data via Data.Element.<element-name>.id
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you only need the one field, then you could set the XPath in the Rest
Client element to $.item.id and you'll end with Element Data named 'id'
(it'll be named whatever the final thing is that you've asked for and is
most-likely case sensitive).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
by the way, XPath uses slashes but JSON Path expressions use $ and dots.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comments
0 comments
Please sign in to leave a comment.