Skip to main content
HttpRequest sends HTTP requests containing application/x-www-form-urlencoded, text, or binary data to external services.

Properties

When ThrowExceptionOnFailed is true (the default) and the response is an error code, the transaction is interrupted and the error message appears in Skill Monitor. When ThrowExceptionOnFailed is false, error responses (4xx/5xx) don’t raise an exception. Inspect Status to check the HTTP status code yourself. A response with an error code means the external service is reachable and responding. Errors related to service availability or connection failures always raise a program exception regardless of this property, and in those cases no HTTP status code is available.
The Timeout value can’t exceed the script runtime limit (600 seconds).

Methods

SetHeader

Sets an additional HTTP header for the request. Call once per header.

Send

Sends the HTTP request.

SetFileContent

Initializes a file-based HTTP request body. The content type is detected from the file extension (for example, application/json, application/pdf). To override, pass mediaType.
  • The first overload sends exported data (from Document.Exports) as a file.
  • The second overload sends binary data, either a source image from when the transaction was created or an image from a field of type Picture.

SetSourceFileContent

Initializes a binary-data request with the source image imported when the transaction was created. The content type is detected from the file extension. Override with mediaType if needed.
SetSourceFileContent is deprecated. It only accesses the first file in a transaction. Use SetFileContent instead.

SetStringContent

Initializes a string-based HTTP request body. Defaults to Content-Type: application/json and UTF-8 encoding. Override either using the optional parameters.

SetUrlFormEncodedContent

Initializes the request body from a JavaScript object and encodes it as application/x-www-form-urlencoded. The object should be a simple set of property/value pairs: