Class: HttpRequest

SFSApi. HttpRequest

The HttpRequest class represents a request to be sent to an external HTTP/HTTPS server.

HTTP/S requests can be of type POST or GET. They are useful to retrieve data from or send data to external services.

See also


new HttpRequest(url, params, mode, httpCallbackFn)

Creates a new HttpRequest instance.

Using the SFSApi#newHttpGetRequest or SFSApi#newHttpPostRequest factory methods instead of this constructor is recommended. See the methods description for usage examples.

Parameters:
Name Type Description
url string The address of the HTTP server to make the request to.
params object An object containing the parameters to send to the HTTP server.
mode SFSApi.HttpMode The HTTP request mode (GET or POST).
httpCallbackFn httpCallbackFn The callback function that will process the response sent by the HTTP server.

Methods


execute()

Executes the HTTP request and calls the httpCallbackFn callback function passed to the constructor.

getConnectionTimeoutSeconds()

Gets the HTTP request timeout seconds.
Returns:
The number of seconds after which the HTTP request will be considered failed.
Type
number

setConnectionTimeoutSeconds(value)

Sets the HTTP request timeout seconds.
Parameters:
Name Type Description
value number The number of seconds after which the HTTP request will be considered failed.