PostData Shell Properties

The PostData Shell property is available if the script is accessed via "ScriptPage" (URL Direct Access Context), and if the Content Type passed to the URL is "application/json", and if the HTTP call is a POST. The included POST data will be available via PostData.

Shell.PostData()

string (output). The POST data from the HTTP call.

You can use an HTTP POST to send JSON data to your script in the URL Direct Access Context. The POST body of the HTTP message is added as a string-Variant to the shell object with Shell.PostData() to provide the body.

First, note the following requirements:

SBM ModScript has from_json(), which will convert the string from JSON to int and string values, with JSON object becoming a Map and JSON array becoming a Vector. As there is no implicit conversion from Variant to string, and since the values on the Shell are Variant, the Variant must be explicitly converted to string while being passed to from_json().

For example:

var y = from_json( Shell.PostData().to_string() );

An example of using the parsed values after calling from_json() is available in Sample Five: RESTDataSource.

Related Topics

Shell Property Descriptions

Shell Properties by Context