Skip to main content

httpApi

// basic setup
const CONNECTOR = window.env.connectorApi;
const url = window.location.href;
let protocoll = url.split("://");
const secure = protocoll && protocoll.length == 2 && protocoll[0].includes("s") ? 's' : '';

const BASE_URL_REST = `http${secure}://${CONNECTOR}`;

const req = {
    action: "POST", // 'GET' | 'POST' | 'PUT' | 'DELETE';
    url: `${BASE_URL_REST}/api/data/connect`,
    headers: [],
    environment: {},
    resolve: resolveFunction,
    responseType: 'blob', // 'json' | 'text' | 'arraybuffer' | 'blob';
    body: {
        Configuration: {
            Route: 'some-sample',
            Authentication: true, // true / false
            AuthenticationType: 'JWT' // JWT / BASIC / API_KEY
            Method: 'POST' // GET / PUT / POST / DELETE / PATCH
        },
        /**
        * Conating information send as Body to the reciving endpoint -> here to some-sample
        */
        ApiConfig: { assetId: '65661401d2f923d89f5e81fd', before: '2023-12-31T14:08:00.000Z', after: '2023-12-01T14:08:00.000Z' }
    }
}