Aller au contenu principal
- Démarrage rapide

Démarrage rapide de l'API

Exécutez le plus petit flux de travail utile : confirmez votre token, importez une ressource, associez-la à un produit Shopify et attribuez des téléchargements à une commande existante.

1. Définissez votre URL de base et votre token

export ALVA_API_BASE="https://<app-host>/api/v1"
export ALVA_API_TOKEN="adk_live_<keyId>_<secret>"

2. Confirmer l'authentification

curl "$ALVA_API_BASE/ping" \
  -H "Authorization: Bearer $ALVA_API_TOKEN"

Un ping réussi confirme que le token peut s'authentifier pour la boutique approuvée.

3. Importez une ressource depuis une URL distante

curl -X POST "$ALVA_API_BASE/assets" \
  -H "Authorization: Bearer $ALVA_API_TOKEN" \
  -H "Idempotency-Key: asset-$(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "source_url": "https://storage.example.com/products/video.mp4",
    "filename": "video.mp4",
    "content_type": "video/mp4",
    "title": "Video lesson"
  }'

4. Interrogez la tâche d'ingestion

curl "$ALVA_API_BASE/jobs/<job_id>" \
  -H "Authorization: Bearer $ALVA_API_TOKEN"

5. Associez le fichier à un produit Shopify

curl -X POST "$ALVA_API_BASE/mappings" \
  -H "Authorization: Bearer $ALVA_API_TOKEN" \
  -H "Idempotency-Key: mapping-$(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "shopify_product_id": "gid://shopify/Product/1234567890",
    "shopify_variant_ids": [],
    "file_ids": [123],
    "pack_ids": [],
    "link_ids": [],
    "license_key_tag_ids": [],
    "download_type": "ZIP",
    "is_active": true
  }'

6. Attribuez des téléchargements à une commande

curl -X POST "$ALVA_API_BASE/orders/5501234567890/assignments" \
  -H "Authorization: Bearer $ALVA_API_TOKEN" \
  -H "Idempotency-Key: assign-$(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "shopify_customer_id": "777888999",
    "items": [
      { "shopify_product_id": "gid://shopify/Product/1234567890" }
    ],
    "send_email": false,
    "fraud_check": false
  }'

Documentation de l'API

Cet article vous a-t-il été utile ?

Toujours bloqué ? Écrivez à admin@alvaapps.com.

Dernière mise à jour 2026-06-05