Getting started
The Quantive Results SDK exposes methods that enable your UI App to interact with Quantive Results content. It builds on top of the Quantive Results REST API and supports CRUD operations with the main Quantive Results modules:
Additionally the SDK exposes the following functionality:
- Settings - an API that enables your UI App to work with the settings your app exposes and users fill in on the App Settings screen.
- Helper Methods - a set of API methods helping you get current context items like the current user, accountId.
Installation
NOTE: The UI Apps SDK works only in the context of a Quantive Results application. You can test the functionality it provides when you submit your app to the Quantive Results Marketplace and test the app in your Quantive Results account. For more information on testing your Ui App, see: Build and publish an app.
The Quantive Results UI Apps SDK is available as an npm package, so you can add it in your project. To install the Quantive Results UI Apps SDK in your project follow the steps below:
- Navigate to your project's directory, open a terminal and run the following command:
npm install @gtmhub/sdk
- Import the library wherever you need it in your JavaScript code:
import gtmhub from "@gtmhub/sdk"
Configuration
Once you have installed the SDK in your app, before you begin using it you must initialize it using the initializeSdk method. Pass a pluginId object to initializeSdk. The pluginId is the identifier of your UI App.It's a good practice to pass a GUID or similar unique identifier, as this Id will later be used when you submit the app to the Quantive Results Marketplace.
The code sample below demonstrates how you:
- import the SDK in your JavaScript file
- initialize it
- and then use the SDK getCurrentItem helper methods to get the current Quantive Results item your UI app is loaded for
Import the initialization method from the SDK:
import gtmhub from "@gtmhub/sdk";
const sdk = initializeSdk({
pluginId: "my-plugin-id"
});
sdk
.getCurrentItem()
.then((item) => console.log(`Current item is, ${item}`))
// ...