S sdleidel Active Member Licensed User Longtime User Feb 5, 2018 #1 Hi, how i can do that in B4j ? curl -v -X GET -H 'authorization: apiKey=N569137931050678' "http://api.mysite.de/v1/user?id=2" Please help me Thanks Sascha
Hi, how i can do that in B4j ? curl -v -X GET -H 'authorization: apiKey=N569137931050678' "http://api.mysite.de/v1/user?id=2" Please help me Thanks Sascha
Erel B4X founder Staff member Licensed User Longtime User Feb 6, 2018 #2 B4X: Dim j As HttpJob j.Initialize("", Me) j.Download("http://...") j.GetRequest.SetHeader("authorization", "apiKey=N569137931050678") Wait For (j) JobDone(j As HttpJob) ... j.Release Make sure that both OkHttpUtils2 and OkHttp libraries are referenced. Upvote 0
B4X: Dim j As HttpJob j.Initialize("", Me) j.Download("http://...") j.GetRequest.SetHeader("authorization", "apiKey=N569137931050678") Wait For (j) JobDone(j As HttpJob) ... j.Release Make sure that both OkHttpUtils2 and OkHttp libraries are referenced.
S sdleidel Active Member Licensed User Longtime User Feb 13, 2018 #3 Many Thanks... That work... But by Post ? curl -X POST -H 'authorization: apiKey=N569137931050678' ""http://api.mysite.de/v1/user/login" --data "username=demo&password=rasmuslerdorf" Upvote 0
Many Thanks... That work... But by Post ? curl -X POST -H 'authorization: apiKey=N569137931050678' ""http://api.mysite.de/v1/user/login" --data "username=demo&password=rasmuslerdorf"
S sdleidel Active Member Licensed User Longtime User Feb 13, 2018 #4 And a second question... PUT (update) DELETE (delete) in Curl... How i can make it in B4j/B4i I found a Bug in B4i ! Thats on B4j: B4X: job1.Initialize("MyToken", Me) job1.PostString("http://api.duundichwir.de/v1/user/login", "username=demo&password=test") job1.GetRequest.SetHeader("Content-Type", "application/json") job1.GetRequest.SetHeader("authorization:", "apiKey=N5691379310506780477") Thats OK... But in B4i you must remove the Line job1.GetRequest.SetHeader("Content-Type", "application/json") because B4i send wrong Data to the "Server" Upvote 0
And a second question... PUT (update) DELETE (delete) in Curl... How i can make it in B4j/B4i I found a Bug in B4i ! Thats on B4j: B4X: job1.Initialize("MyToken", Me) job1.PostString("http://api.duundichwir.de/v1/user/login", "username=demo&password=test") job1.GetRequest.SetHeader("Content-Type", "application/json") job1.GetRequest.SetHeader("authorization:", "apiKey=N5691379310506780477") Thats OK... But in B4i you must remove the Line job1.GetRequest.SetHeader("Content-Type", "application/json") because B4i send wrong Data to the "Server"
Erel B4X founder Staff member Licensed User Longtime User Feb 14, 2018 #5 You should never set the content type header directly. Set it with SetContentType. See the methods in OkHttpUtils2 / iHttpUtils2. Upvote 0
You should never set the content type header directly. Set it with SetContentType. See the methods in OkHttpUtils2 / iHttpUtils2.