Making API requests to third party URLs

Your UI App always runs within the context of Quantive Results account. The Quantive Results platform uses multiple security mechanisms which might interfere with your UI App when you are making request to a 3rd party URL. The UI Apps SDK enables you to make such requests via the request method.

NOTE: Before you start using the SDK methods, ensure you have imported and configured the SDK first.

request

To make a request to a third party URL within your UI app, use the request method from the Quantive Results SDK. For example:

import gtmhub from "@gtmhub/sdk";

const sdk = initializeSdk({
  pluginId: "my-plugin-id"
});

sdk
  .request({
    method: "GET",
    url: "https://some-domain.test.com/api/v1/users",
    params: {
      sort: "descending",
      limit: 100,
    },
    headers: {
      "Authorization": `Bearer ${token}`,
      "gtmhub-accountId": `${accountId}`,
      "Accept": "application/json",
    },
  })
  .then((users) => console.log(users))
  .catch((error) => handleUiError(error));