System generated call external API
Supported methods
- GET | HEAD | POST | PUT | DELETE | CONNECT | OPTIONS | TRACE | PATCH
URL
/api/system-api/user-path/call-external-api
Supported types
- parallel - If the type is 'parallel' the external APIs are executed in parallel.
- sequential - If the type is 'sequential' the external APIs are executed in sequential order, one by one.
Request body
- The below request body contains all supported fields for Call external System API.
| {
"url": "full_url_here",
"method": "POST",
"timeout": 5000,
"body": {
"first_name": "James",
"last_name": "Bond"
},
"queryParams": {
"select": "first_name"
},
"headers": {
"x-am-meta": true
},
"id": "saveCountryId",
"preProcess": [
{
"from": "saveCountryId.output.id",
"to": "body.orderId"
}
],
"postProcess": [
{
"from": "saveCountryId.output.id",
"to": "body.orderId"
}
],
"output": "any"
}
|
title: Call External API Example
description: Demonstrates calling and integrating external APIs via API Maker with an example.
Call external API using global object 'g'.
Simple call external apis
| await g.sys.system.callExternalApi([
{
"url": `your_url`,
"method": "GET",
"timeout": 5000,
"queryParams": { "select": "first_name" },
"headers": { "x-am-authorization": "TOKEN" },
}
]);
|
Parallel type
- If the type is 'parallel' the external APIs are executed in parallel.
| await g.sys.system.callExternalApi([
{
url: "FULL_URL",
method: "POST",
body: [
{
first_name: "James",
last_name: "Bond"
}
],
id: "saveApi",
postProcess: [
{
from: "saveApi.output.body.data.first_name",
to: "setApi.body.first_name"
}
],
queryParams: {
deep: JSON.stringify([{
s_key: "SOURCE_COLLECTION_COLUMN_NAME",
t_key: "TARGET_COLLECTION_COLUMN_NAME",
t_col: "TARGET_COLLECTION_NAME",
select: "COLUMN_NAMES"
}]),
select: "COLUMN_NAMES",
limit: 2,
sort: "COLUMN_NAMES"
},
timeout: 1000,
headers: { "x-am-authorization": "TOKEN" },
},
{
type: 'parallel',
data: [
{
url: "FULL_URL",
method: 'PUT',
body: {},
id: "setApi",
headers: { "x-am-authorization": "TOKEN" }
},
{
url: "FULL_URL",
method: 'GET',
headers: { "x-am-authorization": "TOKEN" }
}
]
}
]);
|
Sequential type
- If the type is 'sequential' the API calls execute one by one.
| await g.sys.system.callExternalApi([
{
url: "your_url",
method: "GET",
timeout: 5000,
queryParams: { "select": "first_name" },
headers: { "x-am-meta": true },
id: "getData",
output: "any"
},
{
type: "sequential",
data: [
{
url: "your_url",
method: "POST",
body: {},
id: "addData",
preProcess: [
{
from: "getData.output.body.data",
to: "addData.body"
}
],
headers: { "x-am-authorization": "TOKEN", "x-am-response-case": "capitalCase" }
},
{
url: "your_url",
method: "GET",
headers: { "x-am-response-case": "capitalCase" }
}
]
}
]);
|
API Response
{
"success": true,
"statusCode": 200,
"data": "requested_API_response_data"
}