API Documentation - Insert Product

Endpoint

POST /product/add

Parameters

The following parameters are required in the request:

  • megatechTitreLibWebFr: The product title in French.
  • code: The product code.
  • fam1ID: The family ID (level 1).
  • fam2ID: The family ID (level 2).
  • megatechQteParBoite: The quantity per box.
  • unite: The unit of measurement.
  • uniteFullName: The full name of the unit of measurement.
  • tauxTvaArticleEcommerce: The VAT rate.
  • PrixVente: The sale price.
  • promoPrice (optional): The promotional price.
  • promoDateBegin (optional): The start date of the promotion.
  • promoDateEnd (optional): The end date of the promotion.
  • isNouveaute (optional): Indicates if the product is a novelty (1 for true, 0 for false).
  • photoBase64 (optional): The base64-encoded photo of the product.

Response

The response is a JSON object containing the following fields:

{
    "success": true,
    "message": "Inserted successfully"
}

If an error occurs, the response will contain the following fields:

{
    "success": false,
    "message": "Error message"
}

Error Handling

If an error occurs, the response will contain the following fields:

{
    "success": false,
    "message": "Error description"
}

Example Request

POST /product/insert
Content-Type: application/x-www-form-urlencoded

megatechTitreLibWebFr=New+Product+Title&code=PROD123&fam1ID=1&fam2ID=2&megatechQteParBoite=10&unite=pcs&uniteFullName=pieces&tauxTvaArticleEcommerce=20&PrixVente=100&promoPrice=80&promoDateBegin=2024-01-01&promoDateEnd=2024-01-31&isNouveaute=1&photoBase64=base64encodedstring

Example Response

{
    "success": true,
    "message": "Inserted successfully"
}