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
Attribute | Type | Description | Required |
---|---|---|---|
URL | string | An API call URL Example: /API/Module/v1.0/Action?Parameter=Value&OtherParam=Value2 | yes |
Options | object | This object uses four properties:
| 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)
}
);
Updated 13 days ago