Data method

The Data method is an interface provided by the developer platform that enables your app to retrieve product-related data as structured JSON payloads. It simplifies access to contextual data such as account, user, and project details, depending on where your app is deployed within the product UI.

Usage

To retrieve data using the Data method, use the following syntax: client.data.get("<objectName>");

The method returns a Promise that resolves with a JSON object containing the relevant data.

Globally Available Data Objects

These objects are accessible from any page within the product UI, regardless of where your app is rendered.

Object Name Description Example Usage
account Details of the current account client.data.get("account")
user Details of the currently logged-in user client.data.get("user")

Page-Specific Data Objects

Some data objects are available only when the app is deployed on specific tabs or pages.

When App is Deployed in the Projects Tab:

Object Name Description Example Usage
project Data of the currently selected project client.data.get("project")
Note: The method returns a Promise, so it should be used with await or .then(). Always check for null or undefined values, especially for page-specific objects.

Example

async function getUserAndAccount() {
  const user = await client.data.get("user");
  const account = await client.data.get("account");

  console.log("Logged-in User:", user);
  console.log("Account Details:", account);
}

What’s Next