Android Question Curl Request

khwarizmi

Active Member
Licensed User
Longtime User
Hi all

Can someone help me with the following curl request :

B4X:
curl https://api.luxand.cloud/photo/verify/1234/
  -X POST \
  -H "token: 1111111111111"  \
  -F "[email protected]"
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Probably you can use httpjob´s PostMultiPart for this.
Note to add the Header as required (The-H line is a header. Name is "token", value is your token.

Search the forum; everything is available (PostMultiPart and also how to set a Header)
 
Upvote 0

khwarizmi

Active Member
Licensed User
Longtime User
B4X:
Dim job1 As HttpJob
    job1.Initialize("",Me)
    job1.Download("https://api.luxand.cloud/photo/verify/1234/")
    job1.GetRequest.SetHeader("token","1111111111111")
    job1.GetRequest.SetHeader("photo","@photo.jpg")

Is that true ?
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
The @ references an actual file, that's a specific curl thing. You need to change that to actually send a file and not just set a header to the string "@photo.jpg".
 
Upvote 0

khwarizmi

Active Member
Licensed User
Longtime User
ok .. thanks for help
the working code is:
B4X:
Dim job1 As HttpJob
    job1.Initialize("",Me)
        job1.PostString("https://api.luxand.cloud/photo/verify/Abuelhaytham? \","photo=" & "https://b4x-4c17.kxcdn.com/android/forum/data/avatars/m/72/72688.jpg?1572609016" )
    job1.GetRequest.SetHeader("token","-------")
    'job1.GetRequest.SetHeader("photo","https://b4x-4c17.kxcdn.com/android/forum/data/avatars/m/104/104625.jpg?1492927523") ' File.DirInternal & "t.jpg")
    Wait For (job1) JobDone(job1 As HttpJob)
    ProgressDialogHide
    Dim res As String
    res = job1.GetString
        Log(res)
 
Upvote 0
Top