🚀 API Maker - Call external APIs
Published: 2023-10-18 09:43:15

##⭐ List of Feature ⭐

✅ Why external API ?
 ▸ They allow information or functionality to be transferred and exchanged among different applications.


✅ Use external API ?
 ▸ This gives businesses the opportunity to leverage another business's data, code, software, or services to improve their own products — and reduce time and cost.


✅ Supported HTTP request method
 ▸ GET| HEAD| POST| PUT| DELETE| CONNECT| OPTIONS| TRACE| PATCH


✅ Below are the Supported Fields
```
{
    "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"
}

```



✅ Easy to use API Maker call external API
 ▸ There is no need to host any function or set a function as a web-hook etc.


✅ Two types of support
 ▸ Parallel : 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.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 : APIs are executed in sequential.
```
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.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" }
            }
        ]
    }
]);

```


----------------------------------




## Youtube video link
https://youtu.be/ztlJn-qe7lc


## Websites
https://apimaker.dev


## API Docs link
https://docs.apimaker.dev/v1/docs/apis-all/system-apis/system-generated-call-external-api.html


## Follow on twitter
https://twitter.com/api_maker


## Linked In
https://www.linkedin.com/company/api-maker