Skip to content

Examples

Examples and Test Cases

These examples use a real GTIN: 00785034739064 (GTIN-14). All URLs use the gtin1.com production domain.

A. Basic Product Resolution

Case URL Expected
Product landing https://gtin1.com/01/00785034739064 307 redirect to product page (HTML) or linkset/JSON based on Accept header. Link header includes linkset reference.

B. Qualifier Contexts (Batch, Expiry, Serial)

Case URL Expected
Batch context https://gtin1.com/01/00785034739064/10/ABC1234 307 redirect with ?lot=ABC1234 appended to destination.
Expiration date https://gtin1.com/01/00785034739064/17/241001 307 redirect with ?expiration_date=241001 appended.
Serialized item https://gtin1.com/01/00785034739064/21/SN123456 307 redirect with ?serial=SN123456 appended.
Lot and serial https://gtin1.com/01/00785034739064/10/ABC1234/21/SN123456 307 redirect with ?lot=ABC1234&serial=SN123456 appended.

C. Content Negotiation

Case Accept Header Expected
Browser (HTML) text/html 307 Temporary Redirect to product page
Linkset (JSON) application/linkset+json 200 OK with RFC 9264 linkset JSON
JSON-LD application/ld+json 200 OK with GS1/schema.org JSON-LD
Plain JSON application/json 200 OK with structured product data
Case URL Expected
Product info https://gtin1.com/01/00785034739064?linkType=gs1:pip 303 See Other redirect to product page
Recall status https://gtin1.com/01/00785034739064?linkType=gs1:recallStatus 303 redirect to recall page (if recall exists), else 404
Certifications https://gtin1.com/01/00785034739064?linkType=gs1:certificationInfo 303 redirect to certifications section (if available), else 404
Explicit linkset https://gtin1.com/01/00785034739064?linkType=linkset 200 OK with linkset JSON regardless of Accept header

E. QR Code Generation

Case URL Expected
SVG QR code https://gtin1.com/01/00785034739064?fmt=svg 200 OK, Content-Type: image/svg+xml
PDF QR code https://gtin1.com/01/00785034739064?fmt=pdf 200 OK, Content-Type: application/pdf
EPS QR code https://gtin1.com/01/00785034739064?fmt=eps 200 OK, Content-Type: application/postscript
QR shorthand https://gtin1.com/01/00785034739064?qr 200 OK, SVG QR code (default format)
PNG (removed) https://gtin1.com/01/00785034739064?fmt=png 400 Bad Request. PNG is no longer supported.

F. Third-Party Serialization (AI 235)

Case URL Expected
TPX serial https://gtin1.com/01/00785034739064/235/TPX123 307 redirect. Treated as third-party instance.

G. Validation Failures

Case URL Expected
Bad GTIN check digit https://gtin1.com/01/00785034739060 400 Bad Request with check digit error message.
Invalid AI value https://gtin1.com/01/00785034739064/17/2513 400 Bad Request. Date AI requires 6 digits in YYMMDD format.
Uneven path segments https://gtin1.com/01/00785034739064/10 400 Bad Request. AI/value pairs must be complete.
Non-digit AI code https://gtin1.com/01/00785034739064/abc/value 400 Bad Request. AI codes must be 2-4 digits.

H. Unsupported Primary Keys

Case URL Expected
SSCC (AI 00) https://gtin1.com/00/340123450000000014 404 Not Found. Message identifies the key type.
GDTI (AI 253) https://gtin1.com/253/4012345000010 404 Not Found. Message identifies the key type.

I. Language Selection

Case URL Expected
Explicit language https://gtin1.com/01/00785034739064?lang=es Response includes Content-Language: es header.
Default language https://gtin1.com/01/00785034739064 Falls back through Accept-Language header, then en.