Set Headers in web API

Hi Team,

is there a way we can set headers to web API in Thunkable Cross Platform ? or any workaround to achieve this. Thank you.

This is only possible in the designer.
grafik

-Red Panda

1 Like

Hi Red_Panda,

Thank you so much for the reply, can we populate this header property value from Local Storage using blocks ? is there any workaround for this.

Hi,

If you show an example request, I can answer your question.

Hi actech,

Thank you for your response, I am unable to post the blocks here but I can explain how it works,

web api url requires authorization header token to Get/Post information, I am storing the authorization token in local storage instead of fetching it at every request. So, when ever an web api call should happen I am fetching the authorization header token from local storage and sending it in headers in web api and this logic works in Thunkable Classic but how to achieve the same logic in Thunkable crossplatform.

If the header line can not be sent as a query parameter (after the ? сharacter), then I see the output only in sending headers via javascript in the WebViewer component. But in this case, there are difficulties with sending the response to the native part.

A query parameter is not a headerā€¦
Are there any plans to implement setting Web API headers via blocks? Without this Thunkable is useless for anything that might rely on many web APIā€™s that require headers (headers are almost never static, they tend to contain keys and authentication tokens).

1 Like

Iā€™m new to APIs altogether - and found out the first day that lflfm is very correct.
I am trying to pull JSON records from a secure server. I was able to use the Design workspace to set the static Content-Type to get my authorization token/key, but now I have no way to use that (volatile) key at run-time. It needs to be used within a couple of minutes in the header KEY PAIR: ā€œAuthorizationā€ field.

Interesting topic. Looking forward to see more info on this.

The ability to set web API headers and query parameters in blocks was just added in our most recent release.

3 Likes