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.