#HEAD or GET request cannot have body?

18 messages · Page 1 of 1 (latest)

vestal spindle
#

I am trying to get some data off an api, where i have to send a customer token and a user token to get access to that information. It should be possible to do via a get request, but i cant seem to get it to work. Does anyone know what i'm doing wrong?

#

sorry for the crappy image btw, just realised how bad it is

#

seems better

steep sequoia
#

You should prob use the ‘POST’ method

#

Or pass the body via url as query Params

fair quarry
#

The token should be passed with Authorization (if not done already as it's hidden)

vestal spindle
#

yeah, i hid the token but it's there. I dont have direct control over the api so i cant use the post method, have to use get. I can try to use query Params

fair quarry
vestal spindle
#

You mean i have to send my tokens via the authorization in the header?

fair quarry
#

yes

vestal spindle
#

Alright, ill try that

fair quarry
#

As you are consuming an API, you should rely on its documentation to know how to pass such information though

vestal spindle
#

I have the documentation, i also got it to work via the body on postman. But angular is pretty new for me, so i'm still figuring everything out.

#

I did have to send it as raw code via postman for some reason, instead of the x-www=form-urlencoded

#

I cant seem to get it to work when i put my tokens under authorization or anywhere in the header. The authorization also includes my bearer token.

fair quarry
#

This bearer token being either your consumer or user token btw