Android Question HPQuestion about post Body

jesuslizonsoluciones

Member
Licensed User
Longtime User
Hello everybody


I am trying to access a url where you have to send the authorization and the body with some keys. I can not access from B4a and instead from postman I have no problem, I do not know if I'm doing correctly the instructions, especially I have doubts, the body of how to send it. I show you the part that I have programmed and the postman screens, to see if you can help me.

1679991492873.png


1679991572264.png

1679991658381.png


Dim j As HttpJob


j.Initialize("", Me)
j.Download(DireccionIpServidor & "/oauth/v1/tokens")

j.GetRequest.SetHeader("x-api-key","5171faa3-5308-49e9-aaaa-babbec18d478")
j.GetRequest.SetHeader("Content-Type","application/x-www-form-urlencoded")
j.GetRequest.SetHeader("Authorization","Basic ZGVzYXJybyak9iRy03Tld6QUNwSw==")


'*********Body

??????????????

'**********


j.Username="usuario"
j.Password="password"






'j.GetRequest.SetHeader("x-api-key","1cefb783a4704e3fbd0613fc8f1bf28da78afb26db6c42d699060af69293696f") ' clave para el acceso

Log(DireccionIpServidor & "/oauth/v1/tokens")

Wait For (j) JobDone(j As HttpJob)
 

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
In PostMan your calls are POST whilst in B4X you use Download which is GET.

You need to use PostString.

x-www-Form-urlencoded mean that the parameters are added to the url string.

You can see this in postman by clicking on the icon on the right.
1680011251932.png


so in the PostString they need to be part of the URL.
 
Upvote 0
Top