Order API
The Order API gives you the ability to query as well as create orders in Crystallize with GraphQL. Every order contains information regarding the purchase and includes the customer details, cart details, as well as any payment-related information.
Authentication is required to access the Order API. You can generate access tokens in order to do so.
To explore the API using the GraphQL playground within the browser, you can add an extension such as Requestly. It modifies network requests and is available for Firefox as well as Chrome. All you need to do is click on the New Rule button and add your access tokens as shown in the picture below.
The snippet below shows how you can fetch an order by ID through cURL. Don't forget to replace the access tokens, order ID, and tenant identifier.
curl \
-X POST \
-H "Content-Type: application/json" \
-H "X-Crystallize-Access-Token-Id: [your-crystallize-token-id]" \
-H "X-Crystallize-Access-Token-Secret: [your-crystallize-token-secret]" \
--data '{ "query": "{ orders { get(id: \"[order-id]\") { total { gross } } } }" }' \
https://api.crystallize.com/your-tenant-identifier/orders