Question

HTTPCaller - How to get a value from the response_body

  • 4 August 2021
  • 4 replies
  • 99 views

Badge +1

I am using the HTTPCaller transformer to perform a GET. How do I take the response and pull out specific attributes and their values?

 

For example, I pass in a list of 5 asset numbers to the HTTPCaller. It performs the GET to return all associated information for each of those assets. I need to pull out, from the response body, only the assetnum and status.


4 replies

Userlevel 4
Badge +26

It depends on the response. The response is probably JSON. In this case you need use the json tools to extract the data.

​Have a read of this article: https://community.safe.com/s/article/json-transformations

There should be some helpful tips​

Badge +1

It depends on the response. The response is probably JSON. In this case you need use the json tools to extract the data.

​Have a read of this article: https://community.safe.com/s/article/json-transformations

There should be some helpful tips​

The response is actually XML.

Badge +5

The response is actually XML.

There are a number of ways to do this but the XMLFlattener is probably the easiest to use.

Userlevel 4
Badge +26

The response is actually XML.

Yep, XMLFlatterner is probably the way to go. You might need to experiment with the settings a little to get the result you want. Check out the documentation of the transformer for help

Reply