I want to make a POST call to an API. In Postman I can make the call with the parameters:
form-data:
jsonKey = {"id":"1", "location":"home address"}
file = homepicture.jpg
I try with code:
something is wrong because the message received in JobDone is:
ResponseError. Reason: Not Acceptable, Response: "Object reference not set to an instance of an object."
I assume NameValues is not formatted correctly...
Can anyone help me with an idea?
Thank you!
form-data:
jsonKey = {"id":"1", "location":"home address"}
file = homepicture.jpg
I try with code:
B4X:
Dim jobSend As HttpJob
Dim fd As MultipartFileData
fd.Initialize
fd.KeyName = "file"
fd.Dir = PathPHOTO
fd.FileName = NamePHOTO
fd.ContentType = "image/jpeg"
Dim flist As List
flist.Initialize
flist.Add(fd)
Dim NameValues As Map
NameValues.Initialize
NameValues.Put("id", "1")
NameValues.Put("location", "home address")
jobSend.Initialize("JobSend", Me)
jobSend.PostMultipart("http://api.xxxxxxxxx.eu/api/uploadfile",NameValues,flist)
something is wrong because the message received in JobDone is:
ResponseError. Reason: Not Acceptable, Response: "Object reference not set to an instance of an object."
I assume NameValues is not formatted correctly...
Can anyone help me with an idea?
Thank you!