cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
715
Views
0
Helpful
4
Replies

Webex Contact Center (WxCC) http request activity response body

vvazquez
Cisco Employee
Cisco Employee

What is the best buy to work with the activity response body output variable in the http request activity? For example to check if one query to an external system is empty. I couldn't do {{httpRequest.httpResponseBody is empty }} or {{httpRequest.httpResponseBody

|length == 0 }}

I was able to make it work parsing the path expression '$' to a new JSON variable that I created, but I guess there should be an easier way.

4 Replies 4

sdoddali
Cisco Employee
Cisco Employee

Both the expressions below should work, you can use test expression feature within the flow builder to test it out.
{{HTTPRequest_23n.httpResponseBody is empty}}

{{HTTPRequest_23n.httpResponseBody | length == 0}}

You can then use the above expressions in the condition node to validate for true/false.

Please find screenshots below.

sdoddali_0-1683648898435.png

sdoddali_1-1683648945710.png

 

 

Thanks for the answer Shrishail.

Yes, when you test in the activity itself, it seems to work. But it didn't when I tried it in a real flow, maybe I am doing something wrong, let me give you one example:

If you send one http get to mockapi.io, you get a JSON answer. If you try to use {{HTTPRequest_23n.httpResponseBody}} later, nothing works. For example, if you try to use {{HTTPRequest_23n.httpResponseBody}}as the body in another http request activity making a post to an external system, nothing is sent.
I need to create one JSON variable ‘myJSONbody’ first, parse HTTPRequest_23n.httpResponseBody to this var myJSONbody, and then I can work with it and use myJSONbody in expressions, or use it as the Body for an http POST.

Victor

Please give more details on what you are trying to achieve. Earlier you mentioned you wanted to perform the empty check, however, I see now you would like to pass the HTTP node response body from node one to another API call in HTTP node 2, is that the case?
Also pls provide an export of your flow.

vvazquez
Cisco Employee
Cisco Employee

Hi Shrishail,

you are right, I should have given more details. I want to use the HTTP node Activity Output variable NODE_NAME.httpReponseBody later in one Condition node, where I am checking if it is empty ([]).

I will be sending you the flow 1:1, since uploading json files is not supported here.

 

Thanks,

Victor