This endpoint allows you to create or update multiple products in a single API call via https://easycms.fi/public_api/set_products/.
https://easycms.fi/public_api/set_products/TOKEN (api_key): Your unique API key for authentication. How to Create API Credentials.username: Your login username. password: Your login password. account: Your specific account ID. | Parameter | Type | Required | Description |
|---|---|---|---|
products |
array | Yes | Array of product objects to create or update |
pid: Product ID to updatestock_data: Array of stock modificationsproducts_multi: Array of multi-location price/barcode datacosts: Array of product cost data (flat associative array)images_add: Array of images to add (base64 encoded)images_delete: Array of image IDs to deletecid: Category ID (required for new products)bid: Brand ID (required for new products)price OR price_gross: Net price or Gross price (required for new products)vatId: VAT ID (required for new products)barcode: Product barcode (auto-generated if not provided)prdNumber: Reference number (auto-generated if not provided)stock_data: Initial stock data (optional)products_multi: Multi-location data (optional)costs: Product cost data (optional)images_add: Images to add (optional){
"status": "success",
"message": "All products processed successfully",
"summary": {
"total": 2,
"successful": 2,
"failed": 0
},
"results": [
{
"index": 0,
"status": "success",
"message": "Product created successfully",
"data": { "pid": 123, "product": {} },
"changes": {}
},
{
"index": 1,
"status": "success",
"message": "Product updated successfully",
"data": { "pid": 124, "product": {} },
"changes": {}
}
]
}
{
"username": "api_user",
"password": "api_pass",
"account": "myaccount.com",
"products": [
{
"cid": 1,
"bid": 2,
"price": 29.99,
"vatId": 1,
"product_name": "New Product 1",
"description": "Description for product 1"
},
{
"pid": 123,
"price": 24.99,
"stockcurrent": [
{ "location_id": 1, "stock": 50 }
]
}
]
}
When some products fail, the API returns a 207 status code with partial success information:
{
"status": "partial_success",
"message": "Some products failed to process",
"summary": { "total": 3, "successful": 2, "failed": 1 },
"results": []
}
Possible error codes for individual products include:
MISSING_REQUIRED_FIELDS: When required fields are missing for new productUPDATE_FAILED: When updating the product failsCREATE_FAILED: When creating the product failsINVALID_STOCK_DATA: When stock data is invalidPRODUCT_NOT_FOUND: When updating a product that doesn't exist