B4J Question [solved] Need Help Convert Curl To okhttp

behnam_tr

Active Member
Licensed User
Longtime User
curl request:
curl --location --request POST
'https://.../GET_SERVER_INFORMATION'
\ --header 'requestTraceId: 1654938179880'
\ --header 'timestamp: 1654938179880'
\ --header 'Content-Type: application/json'
\ --data-raw '{
"time": 1,
"packet": {
"uid": null,
"packetType": "GET_SERVER_INFORMATION",
"retry": false,
"data": null,
"encryptionKeyId": "",
"symmetricKey": "",
"iv": "",
"fiscalId": "",
"dataSignature":""
        }
 }'
 
Solution
i would start with this:
B4X:
    Dim URL As String = ""
    job.Initialize("",Me)
    Dim json As JSONGenerator
    Dim innermap As Map = CreateMap("uid": Null,"packetType": "GET_SERVER_INFORMATION", _
    "retry": False,    "data": Null, "encryptionKeyId": "","symmetricKey": "",  "iv": "", _
    "fiscalId": "",  "dataSignature":"")
   
    Dim datamap As Map = CreateMap( "time": 1, "packet": innermap )
    json.Initialize(datamap)
    job.PostString(URL, json.ToString)
    job.GetRequest.SetContentType("application/json")
    job.GetRequest.SetHeader("timestamp","1654938179880")

and see what the server had to say.

drgottjr

Expert
Licensed User
Longtime User
i would start with this:
B4X:
    Dim URL As String = ""
    job.Initialize("",Me)
    Dim json As JSONGenerator
    Dim innermap As Map = CreateMap("uid": Null,"packetType": "GET_SERVER_INFORMATION", _
    "retry": False,    "data": Null, "encryptionKeyId": "","symmetricKey": "",  "iv": "", _
    "fiscalId": "",  "dataSignature":"")
   
    Dim datamap As Map = CreateMap( "time": 1, "packet": innermap )
    json.Initialize(datamap)
    job.PostString(URL, json.ToString)
    job.GetRequest.SetContentType("application/json")
    job.GetRequest.SetHeader("timestamp","1654938179880")

and see what the server had to say.
 
Upvote 2
Solution

behnam_tr

Active Member
Licensed User
Longtime User
i would start with this:
B4X:
    Dim URL As String = ""
    job.Initialize("",Me)
    Dim json As JSONGenerator
    Dim innermap As Map = CreateMap("uid": Null,"packetType": "GET_SERVER_INFORMATION", _
    "retry": False,    "data": Null, "encryptionKeyId": "","symmetricKey": "",  "iv": "", _
    "fiscalId": "",  "dataSignature":"")
  
    Dim datamap As Map = CreateMap( "time": 1, "packet": innermap )
    json.Initialize(datamap)
    job.PostString(URL, json.ToString)
    job.GetRequest.SetContentType("application/json")
    job.GetRequest.SetHeader("timestamp","1654938179880")

and see what the server had to say.

thanks Solved !!!
 
Upvote 0
Top