Trying to find a HTTP header from a get request

I've been trying to figure out what and where an HTTP header is located as its one of the two tokens I need to interact with this API how do I get the HTTP header?

1 Like

are you taking abut a request headers or response headers?
only request headers are available in the web component, see also the documentation
http://ai2.appinventor.mit.edu/reference/components/connectivity.html#Web

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

response headers.

@Taifun are you still there?

Do you want to send headers with your API request, or receive headers after your API request?

receive headers

as already mentioned, response headers are not available in the web component
Taifun

ok, here's my new question how would you make a GET request in JS and give back both the headers and the information attached in the webveiwer?

Possibly. You may have to create an html page with the javascript in it, accepting parameters from the app, then use the webviewstring to return the outputs.

You may need to add some jquery or other libraries to make it work.

All files should be in the same folder. You have to use physical html files if referencing other files.

May mean sending the request twice, but you could use a google apps script web app to get back the response headers

https://developers.google.com/apps-script/reference/url-fetch/http-response#getAllHeaders()

also,separately, if sending a php POST request you could send the get_headers request