HTTP request response not parsing response body

I am try to get the body of my get request from the HTTP request actions response.
$.hTTPRequest.body I can get what is stored in the body key but I cant get any another json nested within the body json.

As soon as I try to get lets say $.hTTPRequest.body.data the workflow stops seeing this as a variable or returns null. The get request response does match what I am doing above.

I saw this same issue when trying to get the body of a request made to the beta entitlement apis on IdentityNow.

 [map[accessModelMetadata:map[attributes: []
        ] attribute:organisation attributes:map[] cloudGoverned: false created: 2024-07-11T06: 27: 23.963327Z description:\\u003cnil\\u003e directPermissions: [] id: 69420c039e50af419ab42293a0c4fce01asds manuallyUpdatedFields:\\u003cnil\\u003e modified: 2024-07-11T06: 27: 23.963327Z name:entitlementName owner:\\u003cnil\\u003e privileged: false requestable: false segments: [] source:map[id:69420608596abe447db0249e7364092ss name:sourceNmae type:SOURCE
        ] sourceSchemaObjectType:organisation value:entitlementName
    ]
]

above is an example of what is returned when I try to just get the body from the httpRequest response, as soon as I try to get the id it stops recognising it as a jsonpath and takes it as a plain string.

So when I try {{$.hTTPRequest.body.id}} it returns {{$.hTTPRequest.body.id}} instead of the actual id which is 69420c039e50af419ab42293a0c4fce01asds in the above example.

Hi Yassen,

Try using a variable such as $.hTTPRequest.body[0].data, This should hopefully return what you want.

If there are multiple .data attributes - Change the index to what you want. e.g. [1], [2] or [3] or use a wildcard [*]

Thanks,
Liam.

1 Like

Hello @Yaseenl ,

You also try using $.hTTPRequest.*.data and you can also use webhook for checking out workflow output and http request body output .

-Mehul

1 Like

Hi @Yaseenl , Another way to test the response is to review here JSON Parser Online to parse JSON (jsonformatter.org)

1 Like

Nope did not work. Sadly

Did not work as well

Hi,

Have you included the nested attributes within the JSON path?

For example if the attributes are nested within directPermissions, to obtain the ID nested - The path would be $.hTTPRequest.body.directPermissions.id

You have to add the attribute into the path you are trying to get the nested attribute from :slight_smile:

thanks.

Hi @Yaseenl ,

Just try like,

$.httpRequest.body[*].id

If you need to fetch the specific attribute, instead of id, you can use the name of attribute.

Still you need more clarification about the response of body, use another HTTPRequest action below the 1st HTTPRequest action (with the help of webhook site). Without mentioning the authentication , directly place the URL mentioned in webhook site as Request URL. And get the body of HTTPRequest1 - $.httpRequest.body.

After that, make use of the link given by @amahlemohlokonya or JSON Stringify.

I think, this might be helpful to you :slightly_smiling_face:. Thanks!!

Inline variables do not resolve arrays or objects. If the response from your HTTP request is an array of objects, then your json path will return a list of IDs, which is why it is not resolving during a live execution. If you share a sample of what the response body looks like, then we may be able to assist you with a working JSONpath.