Call internal API
Make any Orange Logic API call, including DataTable calls. This utility can only send GET DataTable calls.
CallInternalAPI: function (_sURL, _fCallbackSuccess, _fCallBackFail)
Request parameter attributes
| Attribute | Type | Description | Required |
|---|---|---|---|
URL | string | This attribute must be one of the following:
| yes |
Example 1
Utils.CallInternalAPI(
'/webapi/objectmanagement/share/getlink_4HZ_v1?Identifier=CTL531031&Format=TR1&StickToCurrentVersion=true&LogViews=true&CreateDownloadLink=true&ExpirationDate=2024-12-31T11%3A59%3A59&MaxWidth=1000&FileExtension=.png',
// Success callback
function (oHttp) {
const result = JSON.parse(oHttp.responseText);
Log.Info('Executed successfully: ' + JSON.stringify(result));
},
// Failure callback
function (oHttp) {
const result = JSON.parse(oHttp.responseText);
Log.Warn('Execution failed: ' + JSON.stringify(result));
}
);
Example 2
Utils.CallInternalAPI(
{
Url: `https://mangovations.com/webapi/objectmanagement/share/getlink_4HZ_v1`,
Method: 'POST',
Data: {
'Identifier': `CTL531031`,
'Format': `TR1`,
'StickToCurrentVersion': `true`,
'LogViews': `true`,
'CreateDownloadLink': `true`,
'ExpirationDate': `2024-12-31T11%3A59%3A59`,
'MaxWidth': `1000`,
'FileExtension': `.png`,
},
{
'Identifier': `ZZ13GMR`,
'Format': `TR1`,
'CreateDownloadLink': `false`,
'LogViews': `true`,
'ExpirationDate': `2028-12-31T23:59:59`,
'MaxWidth': `2000`,
'MaxHeight': `2000`,
'FileExtension': `.jpeg`
},
},
// Success callback function
function (oHttp) {
var oResult = JsonConvert.DeserializeObject(oHttp.responseText);
Log.Info('Executed successfully: ' + oResult)
},
// Failure callback function
function (oHttp) {
var oResult = JsonConvert.DeserializeObject(oHttp.responseText);
Log.Warn('Execution failed: ' + oResult)
}
);
Encode special characters
Use the encodeURIComponent function to encode special characters in an internal API call.
Example
var params = {
"CoreField.First_Name": "Kristen",
"CoreField.Last_Name": "Harrison",
"CoreField.Country": "United States of America",
"CoreField.Email1": "[[email protected]](mailto:[email protected])",
"CoreField.Notes": "ID #: 123_456"
};
var query = Object.keys(params)
.map(k => k + ":=" + encodeURIComponent(params[k]))
.join("&");
Utils.CallInternalAPI(
'API/DataTable/V2.2/Contacts.Client.Default:Create?' + query,
// Success callback function
function (\_sResp) {
var oResp = JSON.parse(\_sResp);
Log.Warn('Execution sucessfully: '+ \_sResp);
},
// Failure callback function
function (\_sResp) {
Log.Warn('Execution Failed: '+ \_sResp);
}
);
Updated 27 days ago
