Every request and response on this page was recorded from a real run of this journey against the Closient API. The journey runs every night and fails if any exchange differs from what is shown here, so the examples cannot silently go stale. Source:
tools/api-conformance/api_conformance/journeys/brand_resolver.py.1. Create the brand
A brand belongs to an organization. Your API key is scoped to one, so theorganization_id is the one that key was issued for.
POST /brands/api/v1/brands → 201
POST /brands/api/v1/brands → 201
Request headers:Request body:Response body:
2. Create a product and read its Digital Link
Creating a product under your organization claims its GTIN for you. The response carriesdigital_link: the exact URL a QR code for this product
encodes. Print that, or hand it to any QR generator. If your organization
has a verified custom resolver hostname with an active certificate, the
link uses it. POST /qr/ builds a QR image for you, but it always encodes
the platform resolver domain, so with a custom hostname print
digital_link instead.
POST /products/api/v1/products → 201
POST /products/api/v1/products → 201
Request headers:Request body:Response body:
3. See what your claim still needs before the resolver will serve your URLs
A new claim starts unverified. Whileblocks_resolver_serving is true, a
scan lands on the product’s Closient-hosted page whatever rules you set:
that is what stops someone who claims a GTIN they do not own from
redirecting its shoppers. The checklist lists what promotes the claim.
GET /products/api/v1/products/<gtin>/verification → 200
GET /products/api/v1/products/<gtin>/verification → 200
Request headers:Response body:
4. Attach a typed link
Links are typed by GS1 link relation. The product’s hosted page shows each type in its own section, with your URL as that section’s call to action, and the resolver advertises the type to machine readers (step 8).POST /products/api/v1/product-links → 201
POST /products/api/v1/product-links → 201
Request headers:Request body:Response body:
5. Try to send scans to your own site
A rule decides where a scan goes. Sending it to a URL of your own needs a verified claim, so an unverified one is refused with a 422 that says why.POST /resolver/api/v1/organizations/<organization_id>/resolution-rules → 422
POST /resolver/api/v1/organizations/<organization_id>/resolution-rules → 422
Request headers:Request body:Response body:
6. Send scans to the hosted product page
AHOSTED_PAGE rule is always allowed: it sends the scan to the page
Closient hosts for the product, which shows your product data and links.
POST /resolver/api/v1/organizations/<organization_id>/resolution-rules → 201
POST /resolver/api/v1/organizations/<organization_id>/resolution-rules → 201
Request headers:Request body:Response body:
7. Scan the code like a phone
A phone camera opens the Digital Link in a browser, which asks for HTML. The QR domain only redirects: one hop hands the scan to the resolver, which redirects it on to the product’s hosted page.GET https://gtin.one/01/<gtin14> → 301
GET https://gtin.one/01/<gtin14> → 301
Request headers:Location:
https://www.closient.com/01/<gtin14>?via=gtin.oneResponse body:GET /01/<gtin14>?via=gtin.one → 307
GET /01/<gtin14>?via=gtin.one → 307
Request headers:Location:
https://www.closient.com/pip/<gtin14>/?via=gtin.oneGET /pip/<gtin14>/?via=gtin.one → 200
GET /pip/<gtin14>/?via=gtin.one → 200
Request headers:Response body:
8. Ask the same URL for its links
A machine reader asks forapplication/linkset+json instead. The QR
domain sends it to the resolver with the same one hop, and the resolver
answers there, with no further redirect: the product’s links keyed by link
relation. Each typed link points at its section of the hosted page
(#recipeInfo here), where your URL is the call to action.
GET https://gtin.one/01/<gtin14> → 301
GET https://gtin.one/01/<gtin14> → 301
Request headers:Location:
https://www.closient.com/01/<gtin14>?via=gtin.oneResponse body:GET /01/<gtin14>?via=gtin.one → 200
GET /01/<gtin14>?via=gtin.one → 200
Request headers:Response body:
Next
- Verify the claim to unlock
CUSTOM_URLrules: thechecklistfrom step 3 says what is missing. - Add more typed links; the linkset grows with them.