Execute HTTP request

Execute any external API call and include any asset data. This utility carries out the API call within the task the utility runs in, regardless of whether the Call external API automation is running synchronously or asynchronously.

ExecuteHttpRequest: function (_sURL, _oOptions, _fCallbackSuccess, _fCallBackFail);
+ _oOptions.Method: 
+ _oOPtions.Data:

Limitations

  • The buffer for fetching results is limited to approximately 2 GB.
  • Large assets (greater than 2 GB), especially videos, might impact site performance.

Request parameter attributes

AttributeTypeDescriptionRequired
URLstringAn API call URL
Example: /API/Module/v1.0/Action?Parameter=Value&OtherParam=Value2
yes
OptionsobjectThis object uses four properties:
  • Method: Specify the HTTP call method (GET, POST, etc.). Refer to Mozilla’s documentation for a full list of method options. This property is required.
  • Headers: HTTP headers of the API call
    • Content-Type: By default, the content type is application/json;charset=UTF-8
  • Data: Objects representing the body of the HTTP request.
  • Base64EncodedFiles: A list of mappings between filenames and base64-encoded file content.
    ℹ️ Note To use this option, information in the Data option cannot be falsy.



yes
Example
Utils.ExecuteHttpRequest(
{
Url: `https://api.openweathermap.org/data/2.5/weather?q=Hanoi&appid=${API_KEY}&units=metric`,
Method: 'GET',
},
// Success callback function
function (oHttp) {
var oResult = JSON.parse(oHttp.responseText);
Log.Info('Temparature in Hanoi: ' + oResult.main.temp);
},
// Failure callback function
function (oHttp) {
Log.Warn('Execution failed: ' + oHttp.responseText)
}
);