Hi all, i have this code:
i translate in B4 so:
And return: "BAD REQUEST"
I dont understand where i wrong
Any idea ???
B4X:
curl -s --user 'api:key-c292cc778030d88b68e08b71a49fef6f' \
https://api.mailgun.net/v3/sandbox7506614de5d448eaaeb72b7a58f4ad3c.mailgun.org/messages \
-F from='Excited User <mailgun@sandbox7506614de5d448eaaev72b7a58f4ad0c.mailgun.org>' \
-F to=info@devil-app.com \
-F to=bar@example.com \
-F subject='Hello' \
-F text='Testing some Mailgun awesomness!
i translate in B4 so:
B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Dim job1 As HttpJob
job1.Initialize("MyToken", Me)
job1.Username = "api"
job1.Password = "key-c292cc778030d88b68e08b71a49fef6f"
job1.PostString("https://api.mailgun.net/v3/sandbox7506614de5d448eaaeb72b7a58f4ad0c.mailgun.org/messages",$"{"from":"Excited User <mailgun@sandbox7506614de5d448eaaeb72b7a58f4ad0c.mailgun.org>","to": ["bar@example.com", "info@devil-app.com"],"subject": "Hello","text": "Testing some Mailgun awesomness!"}"$)
job1.GetRequest.SetHeader("Content-Type", "application/json")
job1.GetRequest.SetContentType("application/json")
job1.GetRequest.SetContentEncoding("text/plain")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success Then
ToastMessageShow("Success", True)
Dim res As String
res = Job.GetString
ToastMessageShow(res, True)
'Log("Response from server: " & res)
Select Job.JobName
Case "MyToken"
Dim parser As JSONParser
parser.Initialize(res)
End Select
Else
Log(Job.ErrorMessage)
ToastMessageShow("errore: " & Job.ErrorMessage, True)
ProgressDialogHide
End If
End Sub
And return: "BAD REQUEST"
I dont understand where i wrong
Any idea ???
Last edited: