Aller au contenu
← Documentation

Products API

Gérez vos produits via API REST

Endpoints Disponibles

GET/v1/productsListe tous les produits
GET/v1/products/:idRécupère un produit
POST/v1/productsCrée un produit
PATCH/v1/products/:idMet à jour un produit
DELETE/v1/products/:idSupprime un produit

Créer un Produit

// Create Product
const response = await fetch('https://api.luneo.app/v1/products', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'T-Shirt Premium',
    category: 'apparel',
    price: 29.99,
    customizable: true,
    image_url: 'https://...',
    description: 'T-shirt 100% coton'
  })
});

const product = await response.json();
logger.info('Created:', product.id);

Lister les Produits

// List Products
const response = await fetch('https://api.luneo.app/v1/products?limit=20&offset=0', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

const { data, total } = await response.json();
logger.info(`Found ${total} products`);

Mettre à Jour

// Update Product
await fetch('https://api.luneo.app/v1/products/prod_xxx', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    price: 24.99,
    stock: 150
  })
});

Paramètres

ParamTypeDescription
namestringNom du produit
categorystringCatégorie
pricenumberPrix en €
customizablebooleanPersonnalisable
image_urlstringURL image