API - Products

Manage the products


Routes

Method name Route Parameters OK return code Return
GET /api/products 200 Results of the 'product' loop
GET /api/products/{productId} productId: The product id 200 Results of the 'product' loop for productId
POST /api/products 201 Results of the 'product' loop for the created product
PUT /api/products/{productId} 204 Nothing
DELETE /api/products/{productId} productId: The product id 204 Nothing

Creation

If you want to create a product, you have to send the following fields with the POST method.

General information
  • ref : The product reference
  • default_category : The product default category id
  • price : The product default price
  • currency : The product price currency id
  • tax_rule : The product tax_rule tax rule id
  • weight : The product weight (optional)
  • visible : If true, the product will be visible (optional)
Descriptive
  • locale: The lang locale
  • title: The product title
  • chapo: The product short description (optional)
  • description: The product description (optional)
  • postscriptum: The product conclusion (optional)

Example

{
    "ref": "foo",
    "locale": "en_US",
    "title": "product create from api",
    "description": "product description from api",
    "default_category": 2,
    "visible": 1,
    "price": "10",
    "currency": 1,
    "tax_rule": 42,
    "weight": 10,
    "brand_id": 0
}

Update

To update a product, you have to send the same data (only updated ones) as for a create, but with the PUT method.

Example

{
    "ref": "bar",
    "locale": "en_US",
    "title": "product updated from api",
    "default_category": 3,
    "visible": 1,
    "description": "product description updated from api",
    "chapo": "product chapo updated from api",
    "postscriptum": "product postscriptum",
    "brand_id": 0
}