Initialize the xmc package
-
Complete the SDK quick start.
In the quick start, you initialize the Marketplace SDK
clientpackage, which is required for every Marketplace app.
The Marketplace SDK xmc package is optional by default, but you must initialize it if your app needs to interact with SitecoreAI APIs.
To initialize the xmc package:
-
If you haven't installed the package yet, install it by running the following command in your terminal:
-
In the
useMarketplaceClient.tshook, importXMCfrom the package: -
In the same file, in the
getMarketplaceClientfunction, in theconfigvariable, addXMCto the list of modules, then save your changes:
You can now start making queries and mutations that require access to SitecoreAI APIs, for example, make GraphQL queries. For a full list of operations, refer to the reference documentation.
Requests to SitecoreAI APIs only work in the SitecoreAI environments where your app is installed.
All requests to SitecoreAI APIs must contain the Context ID of your SitecoreAI environment, which you can retrieve from the application context. For code examples, see Make a GraphQL query.