1. Developer guides

Query the application context

Version: 0.4
Note

If you completed the quick start, you've already made this query.

Query the application context to retrieve details about the current Marketplace app, such as its name, status, and deployment URL, and about the Sitecore app, such as environment information and Context IDs.

To query the application context:

  1. In the SDK initialization code where you run the useMarketplaceClient hook, in the Effect Hook, create a new query, then save your changes:

    // Make a query to retrieve the application context
    client.query("application.context")
      .then((res) => {
        console.log("Success retrieving application.context:", res.data);
      })
      .catch((error) => {
        console.error("Error retrieving application.context:", error);
      });
  2. In your web browser, in the Cloud Portal, find and open your Marketplace app in one of its extension points.

  3. Open your web browser's console, then refresh the page.

  4. In the console, find the log for Success retrieving application.context and inspect the object. The object contains all the details about the current Marketplace app.

If you have suggestions for improving this article, let us know!