Skip to main content

Save this helper as get_connectors_informations.js alongside get_auth_token.js from the authorization recipe. Use Node.js 18+ with ES modules enabled. The source queries only the first page (up to 500 connectors), and the helper returns an array of connector metadata, not the illustrative success object shown below.

Node.js 18+
import { getToken } from "./get_auth_token.js";

export const getConnectorInformationsToCreateAConnection = async () => {
const token = await getToken();
const url = "https://maestro.dadosfera.ai/connectors?size=500&page=1";

return fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: `${token}`,
},
})
.then((response) => {
if (response.ok) return response.json();
else throw response.statusText;
})
.then((data) => {
const collection = [];
data.connectors.forEach((connector) => {
collection.push({
connector_id: connector._id,
image_url: connector._source.image,
type: connector._source.category,
connector_name: connector._source.name,
plugin: connector._source.plugin,
connector_version: connector._source.version,
});
});
return collection;
});
};
{"success":true}

Get API auth token

For any API request it is necessary to have the authentication token; this recipe demonstrates how to get it.

Get the essentials

This step is to configure the return according to the need.