Android Question GET command in HTTjob

francodlh

Member
Licensed User
Longtime User
hello, i need some help to do a GET command with Httjob, i need to send a Get command with headers, Postring work fine but i having some issues with get command, i need to send something like that:

GET http://localhost/api/v2/mysql_fdlh/_table

headers


X-DreamFactory-Session-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsInVzZXJfaWQiOjEsImVtYWlsIjoiZnJhbmNvZGxoQGdtYWlsLmNvbSIsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3RcL2FwaVwvdjJcL3N5c3RlbVwvYWRtaW5cL3Nlc3Npb24iLCJpYXQiOjE0NTcwNTEzODEsImV4cCI6MTQ1NzA1NDk4MSwibmJmIjoxNDU3MDUxMzgxLCJqdGkiOiIyZjA0YmRhNzc0NWRlYmU3YjQ0NjkzNjJiN2ZkZDNmYyJ9.zTAcrZWzeHxc5URyn8Hx9MqVIeSS_OVYlNGxCHWV8eEX-DreamFactory-Api-Key: 36fda24fe5588fa4285ac6c6c2fdfbdb6b6bc9834699774c9bf777f706d05a88

im doing like this in B4A


httpTest.Initialize("TraerListadoTablas",Me)

httpTest.GetRequest.InitializeGet("http://"& Main.sErvidor & Main.puErto & "/api/v2/mysql_fdlh/_table")


httpTest.GetRequest.SetHeader("X-DreamFactory-Api-Key:","36fda24fe5588fa4285ac6c6c2fdfbdb6b6bc9834699774c9bf777f706d05a88")'listado de tablas



httpTest.GetRequest.SetHeader("X-DreamFactory-Session-Token:",Main.SessionToken)'listado de tablas
 

DonManfred

Expert
Licensed User
Longtime User
Something like this....
Please note that using localhot is most probably wrong.
Calling localhost on Android will expect to find the Webserver on the Android device.

B4X:
    httpTest.Initialize("TraerListadoTablas",Me)
    'httpTest.GetRequest.InitializeGet("http://"& Main.sErvidor & Main.puErto & "/api/v2/mysql_fdlh/_table")
    httpTest.Download("http://"& Main.sErvidor & Main.puErto & "/api/v2/mysql_fdlh/_table")
    httpTest.GetRequest.SetHeader("X-DreamFactory-Api-Key:","36fda24fe5588fa4285ac6c6c2fdfbdb6b6bc9834699774c9bf777f706d05a88")'listado de tablas
    httpTest.GetRequest.SetHeader("X-DreamFactory-Session-Token:",Main.SessionToken)'listado de tablas
     ´
 
Last edited:
Upvote 0

francodlh

Member
Licensed User
Longtime User
thank you, it works !!!! i have another problems, when i get the session token using
/api/v2/user/session, the length of the string that i use to put the session token is 389 char and the length of the session token in rest api is 379 char, so when i try to connect the rest api send me a error, any idea

IdCliente = jListOfPersons.Get("id")
Nombre = jListOfPersons.Get("name")
Main.SessionToken=jListOfPersons.Get("session_token")'tomo la sesion token son 389 char
Main.iDUsuario=IdCliente
 
Upvote 0

francodlh

Member
Licensed User
Longtime User
hello i fix the problema not using the session token in dreamfactory doing a curl for every connection only i have to send a key api

best regards
 
Upvote 0
Top