Hello, using RESTful API a temporary token is returned and logged with console.log(xmlHttp.responseText);. Does anyone know how to then pass that temporary token to the 'Authorization': '{Authorization}', in the header of a Query for data?
------------------------------ Adam Keever ------------------------------
Does it return the token to you in the response Header or in the body?
If it's in the body then you could potentially iterate over the JSON objects using the JSON channel, then you'll get the value back as a field you can then use in the subsequent JSON request Header field. ie if you iterate over the objects in step C and get a field called "token" you could then put something like this in JSON Request Header field (example here is if the auth header name is "Authorization") : "AUTHORIZATION: {{c.token}}"
If that doesn't work you could maybe iterate the JSON objects and store the values in a Quickbase table somewhere using the Add or Update Record Quickbase channel, then lookup the value in a later step or separate pipeline step and include it using the same format above.
If you're getting the token back in the header then I'd be interested if anyone on this community knows how to capture header data and use it in subsequent pipeline steps. The JSON Request step only provides a "Header Name" and "Header Value" field without an obvious way to differentiate amongst all the returned headers. I tried storing the headers in a Quickbase table but it won't store them.
Sorry for the tome... hopefully something works for you... I'm just getting my API legs under me with Pipelines too.
------------------------------ Brian Richardson ------------------------------
Adam did you still need any help with this? What are you using to call the RESTful API? I am assuming JavaScript of some sort. Admittedly I am not awesome at JavaScript so some of what I say could probably be done in a better or easier way.
Then in my JavaScript I could do something like this now that they are key:value pairs:
tempAuth = data.temporaryAuthorization
and now tempAuth is equal to "CEtP.OV9icTlmajdkdm1fYjM5c2llX2I4ZWFfYV9icXd6ajd4aHJfY2duYXZkcTQ0c3p3ZGJ1ZWthdnlidmV2bTh2ZHJuYjRhNGJ"
I could then use that in the headers for my next call that needed actual authentication. Just do not forget that you need to put "QB-TEMP-TOKEN" before the actual token since it is a temporary token.
tempAuth = "QB-TEMP-TOKEN " + tempAuth
Going with the same example we have been you would want to build your next set of headers like this: