Hi dream team,
I need to call an API using this curl example :
Doc says :
So I tried :
And job.sucess is always false
Any idea how to call this API?
Thanks a lot
Patrick
I need to call an API using this curl example :
B4X:
curl "https://api.safetyculture.io/audits/audit_01ca38a821504cda885736cccbb9ba40/media/9E3BD015-6275-4668-BAF1-296B2F38444C" \
-o 9E3BD015-6275-4668-BAF1-296B2F38444C.jpg \
-H "Authorization: Bearer ..."
The media is downloaded directly, so you should save the output to a file with an appropriate name.
HTTP Request
GET https://api.safetyculture.io/audits/<audit ID>/media/<media ID>
URL Parameters
Parameter Description
audit ID The ID of the audit to retrieve
media ID The ID of the media within the audit to retrieve
Response
The Content-Type will be the MIME type associated with the media, and the body of the response is the media itself.
So I tried :
B4X:
Dim job As HttpJob
CUrl = "https://api.safetyculture.io"
Dim cPost ="/audits/audit_3ec7a77d89544c958c0c8e1a73157cd9/media/ad1133f5-dfd0-4b93-a61d-4f45fddfbd91" As String
cMedia = "2a5b04e7-d4ed-4de4-ba28-5d26e63e40b2.jpg"
job.Initialize("",Me)
job.PostString(CUrl, cPost)
job.GetRequest.SetContentType("image/jpeg")
job.GetRequest.SetHeader("authorization", "Bearer " & cIOToken)
Wait For (job) JobDone(job As HttpJob)
If job.Success Then
job.GetString()
End If
And job.sucess is always false
Any idea how to call this API?
Thanks a lot
Patrick