cURL Examples
Copy-paste cURL examples for the key TrackVision API endpoints.
Set these environment variables first:
export TV_API_KEY=tv_key_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export TV_BASE=https://api.acme.trackvision.ai/v1
Products
# List products
curl "$TV_BASE/products" \
-H "Authorization: Bearer $TV_API_KEY"
# List products with search and pagination
curl "$TV_BASE/products?search=cotton&page=1&per_page=25" \
-H "Authorization: Bearer $TV_API_KEY"
# Get a single product
curl "$TV_BASE/products/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "Authorization: Bearer $TV_API_KEY"
# Create a product
curl -X POST "$TV_BASE/products" \
-H "Authorization: Bearer $TV_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Organic Cotton T-Shirt",
"sku": "TSHIRT-001",
"gtin": "09506000134352",
"category": "apparel",
"color": "White",
"size": "M",
"weight": 0.2,
"weightUnit": "kg"
}'
# Update a product
curl -X PUT "$TV_BASE/products/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "Authorization: Bearer $TV_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"variant": "White / L",
"size": "L"
}'
# Delete a product
curl -X DELETE "$TV_BASE/products/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "Authorization: Bearer $TV_API_KEY"
Suppliers
# List suppliers
curl "$TV_BASE/suppliers" \
-H "Authorization: Bearer $TV_API_KEY"
# Create a supplier
curl -X POST "$TV_BASE/suppliers" \
-H "Authorization: Bearer $TV_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "GreenFibre Co.",
"email": "contact@greenfibre.com",
"contactName": "Sarah Chen",
"status": "active",
"categories": ["apparel", "textiles"]
}'
DPP Data
# Get full DPP (Verifiable Credential)
curl "$TV_BASE/products/a1b2c3d4-e5f6-7890-abcd-ef1234567890/dpp" \
-H "Authorization: Bearer $TV_API_KEY"
# Get a single DPP category
curl "$TV_BASE/products/a1b2c3d4-e5f6-7890-abcd-ef1234567890/dpp/composition" \
-H "Authorization: Bearer $TV_API_KEY"
# Get materials data
curl "$TV_BASE/products/a1b2c3d4-e5f6-7890-abcd-ef1234567890/materials" \
-H "Authorization: Bearer $TV_API_KEY"
# Get carbon footprint data
curl "$TV_BASE/products/a1b2c3d4-e5f6-7890-abcd-ef1234567890/carbon-footprint" \
-H "Authorization: Bearer $TV_API_KEY"
# Get supplier certifications
curl "$TV_BASE/suppliers/b2c3d4e5-f6a7-8901-bcde-f12345678901/certifications" \
-H "Authorization: Bearer $TV_API_KEY"
GS1 Resolver (Public — No Auth Required)
# Redirect to product page (consumer QR scan)
curl -L "https://resolver.acme.trackvision.ai/01/09506000134352"
# Get DPP as JSON-LD Verifiable Credential
curl "https://resolver.acme.trackvision.ai/01/09506000134352?linkType=gs1:dpp"
# Get DPP via Accept header
curl "https://resolver.acme.trackvision.ai/01/09506000134352" \
-H "Accept: application/ld+json"
# Get structured DPP data via itemtrace
curl "https://resolver.acme.trackvision.ai/itemtrace?gtin=09506000134352"
Site Download
# List sites
curl "$TV_BASE/sites" \
-H "Authorization: Bearer $TV_API_KEY"
# Download site as ZIP
curl "$TV_BASE/sites/c3d4e5f6-a7b8-9012-cdef-012345678902/download" \
-H "Authorization: Bearer $TV_API_KEY" \
-o my-site.zip