Uusi
18.3.2025
AI Commerce provides a GraphQL interface, which enables a flexible and efficient way to retrieve information from the platform. GraphQL is particularly useful as it allows partners the freedom to precisely define the data they need, reducing unnecessary data transfer and speeding up request processing.
How does GraphQL work in the AI Commerce environment?
AI Commerce uses the Apollo GraphQL server to receive requests and return only the requested data. Partners can use GraphQL to retrieve products, countries, and other information from the AI Commerce platform. GraphQL requests are made as HTTP POST requests and require correct authentication credentials in the header field.
Making a GraphQL request
GraphQL requests are made in JSON format using the load balancer address, which is obtained from the environment variable APP_LOAD_BALANCER_URL
. For example, you can retrieve five products as follows:
Required headers
Each GraphQL request requires the following headers:
X-GraphQL-Secret
: AI Commerce security key.X-Tenant-Id
: Store alias.X-Tenant-Secret
: Tenant API key.Content-Type
:application/json
.
Summary
GraphQL is an efficient and flexible way to retrieve data from the AI Commerce platform. We recommend using AI Commerce's Lambda load balancer to enhance security.
For more information on the GraphQL interface, see the detailed documentation in our knowledge base.