HTTP
Execute an HTTP(s) connection and fetch the result
Available since 6.0.2 version.
Result expressed as a String (e.g. a JSON or XML result content)
Syntax
Argument detail
uri: URI, expressed as http:// or https:// with or without variables, expressed as :XXX
Settings detail
Example
Execute an HTTP(s) connection and fetch the result
result expressed as a String (e.g. a JSON or XML result content)
Syntax
Details
HTTP response codes included between 200 and 399 are managed as correct answers and the response is sent back through the "json" return variable.
In case of HTTP response codes above or equal to 400, an exception is fired _and the exception content would contain the message sent back by the invoked web service; consequently, it would be better to surround this instruction between try-catch.
Important note: Please pay attention to the URL definition: it must respect the HTTP syntax, which means it cannot contains special characters, such as a space or \n. In case of special characters, you will get an HTTP error when trying to use the URL. In such a scenario, use the encodeURI method:
Examples with errors:
Execute an HTTP(s) connection and fetch the result (with headers)
result expressed as a String (e.g. a JSON or XML result content)
Syntax
Details
HTTP response codes included between 200 and 399 are managed as correct answers and the response is sent back throughthe "json" return variable.
In case of HTTP response codes above or equal to 400, an exception is fired and the exception content would contain the message sent back by the invoked web service; consequently, it would be better to surround this instruction between try-catch.
Important note: Please pay attention to the URL definition: it must respect the HTTP syntax, which means it cannot contains special characters, such as a space or \n. In case of special characters, you will get an HTTP error when trying to use the URL. In such a scenario, use the encodeURI method:
Example
Execute an HTTP(s) connection and fetch the result (most flexible version)
result expressed as a String (e.g. a JSON or XML result content)
Syntax
Details
Supported attributes by "additionalSettings" argument:
log: true|false - used to turn down the automatic logging of an HTTP request; helpful when you don't want to log credentials passed forward or when you have a large number of requests
enableSNIExtension: true|false - used to customize the SNI settings per single request
HTTP response codes included between 200 and 399 are managed as correct answers and the response is sent back throughthe "json" return variable.
In case of HTTP response codes above or equal to 400, an exception is fired and the exception content would contain the message sent back by the invoked web service; consequently, it would be better to surround this instruction between try-catch.
Important note: Please pay attention to the URL definition: it must respect the HTTP syntax, which means it cannot contains special characters, such as a space or \n. In case of special characters, you will get an HTTP error when trying to use the URL. In such a scenario, use the encodeURI method:
Execute an HTTP(s) connection and fetch the result (binary content)
result expressed as a binary content and store it into the specified file
Syntax
Fetches the HTTP response, expressed as a binary content and stores in to the specified file.
Important note: Please pay attention to the URL definition: it must respect the HTTP syntax, which means it cannot contains special characters, such as a space or \n. In case of special characters, you will get an HTTP error when trying to use the URL. In such a scenario, use the encodeURI method:
Execute an HTTP(s) connection and fetch the result (binary content) optionally with a body requiest (binary content)
result expressed as a binary content and store it into the specified file
Syntax
Fetches the HTTP response, expressed as a binary content and stores in to the specified file.
You can pass forward a String based request body as usually (using "requestBody" argument) or pass forward a binary content, using the "settings" argument, where specifying a "fromFile" attribute, filled with an absolute path (including file name) to the file to pass forward, which must be located in the server file system.
Settings can also accept an optional attribute named "headers" containing a javascript object related to the set of request headers to pass forward.
Example
Execute an Alfresco web script
starts with "service/xyz?..." and fetch the result, expresses as a String (e.g. a JSON or XML result content)
Syntax
Details
Execute an HTTP(s) connection using NLTM authentication
result expressed as a String (e.g. a JSON or XML result content)
Syntax
Details
HTTP response codes included between 200 and 399 are managed as correct answers and the response is sent back through the "json" return variable.
In case of HTTP response codes above or equal to 400, an exception is fired an the exception content would contain the message sent back by the invoked web service; consequently, it would be better to surround this instruction between try-catch.
The "settings" js object can include the following attributes:
"connectionTimeout: an optional number defining the timeout for the connection
"headers": a js object containing request headers, e.g. required credentials
Example:
Last updated