How to HTTP POST API Request Json Format

Hello,

I order to go for a subscription I need to understand if it is possible to make this kind of POST request to a local intranet server.

In the information of the API I should send this JSON Format body:

I make the request working with PostMan but no way to understand how to do it with Wappler.

Method: POST
URI: http://localhost:8081/wms/rest/missions?&sessiontoken=uAzDPqMRPfEhg05X3ajXsw%3D%3D
Data:
{
“missionrequest”: {
“requestor”: “jean”,
“missiontype”: “0”,
“fromnode”: “S1-Pick”,
“tonode”: “Station 1”,
“cardinality”: “1”,
“priority”: 0,
“deadline”: “2015-02-25T12:27:41.043Z”,
“dispatchtime”: “2015-02-25T12:27:41.043Z”,
“parameters”: {
“value”: {
“payload”: “Something”
},
“desc”: “Mission extension”,
“type”: “org.json.JSONObject”,
“name”: “parameters”
}
}
}

Any help?

Thanks in advance.

http://localhost:8081/wms/rest/mission is your url

sessiontoken=uAzDPqMRPfEhg05X3ajXsw%3D%3D is your parameter

Hello,

Thanks for the aswer.

The post request needs that Json Body…

My question is how to send that Json Body.

BR,

Just set it up as a Server Connect API action

(may need to be in headers rather than parameters, try both)

and how to sen the Json body?

{
“missionrequest”: {
“requestor”: “jean”,
“missiontype”: “0”,
“fromnode”: “S1-Pick”,
“tonode”: “Station 1”,
“cardinality”: “1”,
“priority”: 0,
“deadline”: “2015-02-25T12:27:41.043Z”,
“dispatchtime”: “2015-02-25T12:27:41.043Z”,
“parameters”: {
“value”: {
“payload”: “Something”
},
“desc”: “Mission extension”,
“type”: “org.json.JSONObject”,
“name”: “parameters”
}
}
}

Thanks in advance

they are all just parameters

Hi Miguel,

You may have to type those nested elements into the php file directly as the GUI of the editor does not support this. I generally put the base parameter in, and then open in the editor to manually add the rest.
This thread might help: Setting server side object variables

–Ken

1 Like

Hello Ken,

Many Thanks for the answer. I will check and keep you informed.

Best regards,

In the next Wappler update there will be support for entering complex JSON data to be submitted to API’s with an own dedicated editor.

2 Likes

In Wappler 2.3.4 it’s now possible to use nested JSON data structures directly in the Server API Connector UI.

1 Like

That’s great.

I had a terrible week. Not much time to test it.

Many Thanks to all.