Android Question How to pass this parameter into httputils to hit GET API

syerif

Active Member
Licensed User
Longtime User
Hi,

I got problem with httpjob to hit API GET

Raw Body Request:
{
    "GetDcustomer": {
    "INSTCODE": "02001",
    "CUSTCODE":"",
    "BRANCHCODE":"02"
    }
    }

Download Code:
    Dim m1 As Map = CreateMap("INSTCODE":"02001","CUSTCODE":"","BRANCHCODE":"02")
    Dim m2 As Map = CreateMap("GetDcustomer" : m1)
    
    'Log(m1.As(JSON).ToString)
    Log(m2.As(JSON).ToString)
    

    
    Dim j As HttpJob
    j.Initialize("j",Me)
    
    j.Username ="xxx"
    j.Password ="xxxx"
    
    j.Download2(Link & "Service/GetDcustomer",m2.As(JSON).ToString)
    j.GetRequest.SetContentType("application/json")  ' --> get error over here
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
    End If
    j.Release

Thank you
 

syerif

Active Member
Licensed User
Longtime User
You can’t pass body to GET. Use POST with job.PostString
I know that GET can't send body requests, but the API that was given to me requires a body request and it's listed in the documentation, and I tried the API via postman and got a successful response
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I know that GET can't send body requests, but the API that was given to me requires a body request and it's listed in the documentation, and I tried the API via postman and got a successful response
okhttputils (okHTTP) does not support this.
 
Upvote 0
Top