Make your first request
Create a key, send one product, read it back, subscribe to events and put the viewer on a product page.
Everything works on your article number: the number you already use in your product system and on your product pages. The base URL is https://platform.charpstar.co.
Create a key
Make a key in Settings, then Developer on the platform. Create an API key shows the form. Store the key as a secret on your server, for example as CHARPSTAR_API_KEY, then check that it works:
curl -sS https://platform.charpstar.co/api/v1/me \
-H "Authorization: Bearer $CHARPSTAR_API_KEY"{
"client": { "id": "e2b7c1d4-5a6f-4b8c-9d0e-1f2a3b4c5d6e", "name": "Your Company" },
"keyPrefix": "cs_live_Ab3d",
"scopes": [
"products:read", "products:write", "reviews:write",
"assets:read", "webhooks:manage", "account:read"
]
}Send one product
curl -sS https://platform.charpstar.co/api/v1/products \
-H "Authorization: Bearer $CHARPSTAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"articleId": "CH-1001",
"name": "Oslo lounge chair",
"category": "Furniture/Chairs",
"dimensionsCm": { "w": 72, "h": 81, "d": 78 },
"referenceImages": [{ "url": "https://example.com/images/oslo-front.jpg" }],
"productLink": "https://example.com/products/oslo-lounge-chair"
}'The answer is 201 with "result": "created" and "status": "received". Send the same body again and you get 200 with "result": "unchanged". So it is safe to send your whole catalogue on every sync.
Read it back
curl -sS https://platform.charpstar.co/api/v1/assets/CH-1001 \
-H "Authorization: Bearer $CHARPSTAR_API_KEY"- While we work on it,
statusmoves fromreceivedtoin_production,in_review,approvedand finallydelivered. - Once it is delivered, the answer carries the 3D files, the viewer and AR links, the embed snippet and the images.
This is the viewer link of a delivered article:
Subscribe to events
curl -sS https://platform.charpstar.co/api/v1/webhooks \
-H "Authorization: Bearer $CHARPSTAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://example.com/charpstar/events" }'- Keep the
secretfrom the answer. It is shown once, and you need it to check that events really come from us. See Check a signature. - Then ask for a test event, using the
idfrom the answer:
curl -sS -X POST https://platform.charpstar.co/api/v1/webhooks/$WEBHOOK_ID/test \
-H "Authorization: Bearer $CHARPSTAR_API_KEY"Paste the snippet on your product page
<script src="https://js.charpstar.net/V2/charpstAR-Base.js" data-client="YourCompany" defer></script>
<charpstar-viewer data-articleid="CH-1001"></charpstar-viewer>- The viewer stays hidden until the model is delivered, then shows up by itself. There is nothing to deploy on the day it is approved.
- Your exact
data-clientvalue is in every delivered asset underembed.dataClient.
Embed the viewer covers sizing, Shopify and the events the viewer sends.