hTTPPost

Net.hTTPPost(url, postData, [timeout])

Parameters

url URL to send HTTP POST request to.
postData Data to send as part of POST request as a string.
timeout (optional) Timeout in milliseconds.
headerNames (optional) Array string of header names to append to the post request
headerValues (optional) Array string of header values to append to the post request (must match count of headerNames)

Returns

The HTTP POST request response as a string.

Description

Sends an HTTP POST request to url with postData stored in the request body. If timeout is specified the request will timeout after timeout milliseconds. Suspends script execution until the request completes, or the request times out.

Example

var resp = Net.hTTPPost(
 "https://postman-echo.com/post", 
 "Some text");
 
 print(resp);

// post to an echo server
var resp = Net.hTTPPost(
 "https://postman-echo.com/post", 
 "banana", 
 1000, 
 ["customHeaderTitle"], 
 ["customHeaderValue"]);
 
 print(resp);