HTTP Request from REST Call

Hi,

I am doing a REST Call from via a CreateRecord Flow function. My server is sending me back X-Auth-Token in the Response Header. I need to send this Auth Token back for future requests made for that session. How do I get a handle on the Response Header and the X-Auth-Token?

Hi!

Sorry for the late response!

Instead of the Create Record node you can use the HTTP Request node (found in the flow functions marketplace). You can configure that node exactly like the REST API resource: putting in the url, headers, request body, etc. From that node, you access the response headers like this:

Here I’m using the example of setting an app variable with the binding type Output value of another node.

Hello,
But how can you read the value of a specific header from the Response headers object?

When you set a Variable = Output of the HTTP Request flow function, set the Variable = (formula) that looks like this: outputs[“HTTP request”].resHeaders

And that will give you the Header response data you want.

Hi John,
I am using that formula but not sure how to then check the value of a specific header. How are the headers stored in the page variable with the header information?

What i would do is display the header output in an Alert flow function so you can see the data and how its structured. I wouldnt know what to look for unless i saw it first

Hi John,
I set an alert flow to display the output of the http request header but it shows up as empty {} even though I see in the browser the request was successful and returned headers.

Oh I see what is happening. You don’t seem to be able to assign Response headers to alert flow function (I was doing it with a formula). So not sure how else to check the structure.

Maybe create an empty Object variable (with just the id field) and set that = output of HTTP Request response header. Then display the Object variable in an Alert?

That worked in terms of being able to assign the object to alert, but it still returns {}

Could this be a system bug?

I will try to do this myself and report back

Hey,

I also did some testing, and it seems like [“HTTP request”].resHeaders comes in a map object. So try using the formula outputs["HTTP request"].resHeaders.map['header-name'], header-name being the header you want to access.