Hi,
Is there any way to call external APIs in JavaScript hooks in Celigo?
At least in the Celigo custom API builder?
We need to get a response from an API without creating an HTTP universal connection inside Celigo.
Refer to the sample JS code below.
const requestHelpers = { "HTTPRequestHeaders": { "accept": "application/json,text/javascript, /; q=0.01", "accept-language": "en-GB,en-US;q=0.9,en;q=0.8,es;q=0.7", "cache-control": "no-cache", "pragma": "no-cache", "sec-ch-ua": ""Not(A:Brand";v="8", "Chromium";v="144", "Google Chrome";v="144"", "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": ""Linux"", "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "same-origin", "x-requested-with": "XMLHttpRequest", "cookie": "**** Cookie is predefined and never expires. The Cookie length is more than 1024 characters ****", "Referer": "https://externalURL.com" }, "getClientList": "https://externalURL.com/getClients", "getAllDevices": "https://externalURL.com/getDevices" } async function getClientList(options) { const url = requestHelpers.getClientList; const response = await fetch(url, { method: 'GET', headers: requestHelpers.HTTPRequestHeaders }); const data = await response.json(); return { statusCode: 200, body: data }; }
We need to do a similar approach with Celigo.