AustinK
5 years agoQrew Commander
Re: RESTful API Header
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.
https://developer.quickbase.com/operation/getTempTokenDBID
After executing the code on the temporary token page everything you want is contained within the xmlHTTP.responseText. Here is what mine looks like.
"{
"temporaryAuthorization": "CEtP.OV9icTlmajdkdm1fYjM5c2llX2I4ZWFfYV9icXd6ajd4aHJfY2duYXZkcTQ0c3p3ZGJ1ZWthdnlidmV2bTh2ZHJuYjRhNGJ"
}"
I would then take that and do the following:
Then in my JavaScript I could do something like this now that they are key:value pairs:
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.
Going with the same example we have been you would want to build your next set of headers like this:
https://developer.quickbase.com/operation/getTempTokenDBID
After executing the code on the temporary token page everything you want is contained within the xmlHTTP.responseText. Here is what mine looks like.
"{
"temporaryAuthorization": "CEtP.OV9icTlmajdkdm1fYjM5c2llX2I4ZWFfYV9icXd6ajd4aHJfY2duYXZkcTQ0c3p3ZGJ1ZWthdnlidmV2bTh2ZHJuYjRhNGJ"
}"
I would then take that and do the following:
var data = JSON.parse(xmlHttp.responseText)
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:
var headers = {
'QB-Realm-Hostname': 'myRealm.quickbase.com',
'User-Agent': '{User-Agent}',
'Authorization': tempAuth,
'Content-Type': 'application/json'
}