Hello community,
I have a doubt here... Using httpJob I know how to send a POST using parameters map (postMultiPart) and even to send a file. But now I have a post request listed in PostMan constructed in this way:
Link:
In "body" , raw data, something like this:
How do I code this using traditional "map" architecture in httpjob.postmultipart ? (usually is something like this):
Will that work ? (a multi level map simulating the raw json requested by the api in body)? If no, how is the code to send a json in "body" using httpJob (considering also that in postMan test the selected method is "POST", the link has the parameter access_token in it and the json data is configured in section "body->raw"
does anybody have any experience with that?
Thanks!
I have a doubt here... Using httpJob I know how to send a POST using parameters map (postMultiPart) and even to send a file. But now I have a post request listed in PostMan constructed in this way:
Link:
In "body" , raw data, something like this:
JSON:
{
"notification_url": "https://notreturn.com/res/mp.php",
"external-reference" : "123456789",
"items" : [
{
"title":"Payment",
"quantity":1,
"currency_id":"BRL",
"unit_price":10.0
}
]
"payment_methods": {
"excluded_payment_types": [
{ "id": "ticket" },
{ "id" : "bank_transfer" }
]
}
"back_urls" {
"success":"https://blha1.com",
"failure":"https://blha2.com",
"pending":"https://blha3.com"
}
"auto_return": "all"
}
How do I code this using traditional "map" architecture in httpjob.postmultipart ? (usually is something like this):
B4X:
Dim job as httpJob
Dim postMap as map
Dim itemsList as List
Dim item1 as Map
Dim link as string = "https://api.serviceprovider.xpto/preferences?token=3434-cdf3-sd2ws-fgrt54t-sdfdf" <- notice that I used the link with "token" parameter even in POST method
map.put("notification_url","https://notreturn...")
...
item1.put("title","Payment")
itemsList.initialize
itemsList.add(item1)
...
map.put("items",itemsList)
...
job.initialize("",me)
job.postMultipart(link,postMap,null)
...
Will that work ? (a multi level map simulating the raw json requested by the api in body)? If no, how is the code to send a json in "body" using httpJob (considering also that in postMan test the selected method is "POST", the link has the parameter access_token in it and the json data is configured in section "body->raw"
does anybody have any experience with that?
Thanks!