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.

Is there any documentation available on this?

I can’t figure out how to setup an API POST request including a raw nested JSON body containing multiple objects with child fields. Any help would be very much appreciated :slight_smile:

Besides that request, how would I send form-date as the body contents in a GET request?

Thanks again for any help :smiley:

Once you choose a data type of JSON in the api action, you are given a JSON data field in which you can type out the exact json you require. If you click on the pencil of the JSON data field, you are presented with a larger editor and the ability to select dynamic data.

1 Like

Thanks for your reply @mebeingken

I don’t see those fields in the settings on my front-end API Action however.
Are these only available on server-side API Actions probably?

image

Hello @Emiel
You need to use the API Action in the Server Connect, not the one available on the front-end (app connect).