B4J Question CURL Requests

icakinser

Member
Licensed User
Longtime User
How would I program this?

curl -X GET \
-H "API-KEY-ID: {YOUR_API_KEY_ID}" \
-H "API-SECRET-KEY: {YOUR_API_SECRET_KEY}"\
https://{apiserver_domain}/v1/account

I am not very familiar with how to do curl requests
 

DonManfred

Expert
Licensed User
Longtime User
Something like

B4X:
    Dim Job As HttpJob
    Job.Initialize("UpDateProduction", Me)
    Job.Download("https://{apiserver_domain}/v1/account")
    Job.GetRequest.SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0")
    Job.GetRequest.SetHeader("API-KEY-ID","{YOUR_API_KEY_ID}")
    Job.GetRequest.SetHeader("API-SECRET-KEY","{YOUR_API_SECRET_KEY}")
    Job.GetRequest.SetContentType("application/json;charset=UTF-8")
    Wait For (Job) JobDone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
    Else
        Log(j.ErrorMessage)
    End If
    j.Release

It depends on okhttputils2 and okhttp
 
Upvote 0
Top