HTTP Get with HeaderRequest Authentification

Hey guys :slight_smile:
I have a problem when trying to connect to a api get get the results from the REST.
I need the header "Authorization: FlespiToken XXXXXXXXXX"
i found serval suggestion but none work.
Curl command works:
"curl -X GET --header 'Authorization: FlespiToken XYZX' 'https://zdfvsdgsdfg/fhdfg'

I also tried this:


but i get error 1111: request headers are not valid: element 2 does not contain two elements

  1. Put the Web1.RequestHeaders above the Web1.Url block

  2. Headers need to be requested as a list of lists - the sublists being lists of pairs.

     Make a list : Make a list: Authorisation
                                Make a list: abc
                                             123

That was a good hint.
I now get an answer that the Token is denied, but its the same as in curl -.-

Try one of these ( I note you left empty sockets...)

but remove all the : (colons) and don't forget to add a space between the text FlespiToken and the token, the header must be a list of lists!

Make a list : Make a list: Authorization
                           FlespiToken XYZX

Taifun


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

1 Like

I had spaces :wink:

thanks Timai and Taifun, i tried both versions, with and without spaces and without :
Anwser is expired token or missing Header.
A debug would be nice.
i though maybe before i set the RequestsHeaders, i try to set is as text and show it in the app before but that did not work either

Are you sure you tried this:

(check spelling of Authorization, because I used an s instead of a z)
(I have put the space in as a block to make it obvious)
(note the two "make a lists")

Ah! How you did this? Make a list has two inputs at mine and the join has only 2.

Click on the mutator (the small blue square), then you will see you can remove the empty socket.

http://ai2.appinventor.mit.edu.ezproxy.canberra.edu.au/reference/concepts/mutators.html

You can also use Dictionaries for better readability (or visualisation :joy:; I don' know the term used for blocks)