http.post

Prev Next

Description

Performs an HTTP POST to a specified network resource URI and returns the response.


Input Parameters

Name Type Required Description
uri Text Yes Network resource URI
[headers] Text No Request headers
[body] Text No Request body
[contentType] Text No Request body content type

Returns

An array response from the network resource, including both the response code and message.

Common Response Codes:

Code Description
200 Success / OK
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
501 Not Implemented

Examples

// send http POST
var response = network.http.post("https://mydomain.com/test");

// get response code and message
var code = response[0];
var message = response[1];
// prepare headers
var headers = {
    "X-User-Name": "John Doe",
    "Age": 30
};

// prepare body
var body = {
    Name: "Doe, John",
    Age: 30
};

// send http POST, passing headers, URL arguments, and body
var response = network.http.post("https://mydomain.com/test?User=Bob", headers, body, "application/json");

// get response code and message
var code = response[0];
var message = response[1];

Remarks

An HTTP POST is designed to return immediately. This is typically used for asynchronous communications between software systems.

Inputs can be passed both on the resource URI and via any passed header name-value pairs.