Inventory & Products | Products | Product Data | Set Products (Bulk)

Setting Products (Bulk)

This endpoint allows you to create or update multiple products in a single API call via https://easycms.fi/public_api/set_products/.

Important Notes

  • All parameters marked as MANDATORY are required
  • Each product object follows the same structure as set_product
  • When some products fail, the API returns a 207 status code with partial success information

Endpoint and Method

  • Endpoint: https://easycms.fi/public_api/set_products/
  • Method: POST only
  • Content-Type: application/json

Parameters | Payload

  • 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

Product Object Structure

For UPDATE (pid provided)

  • pid: Product ID to update
  • Any product fields to update (only provided fields will be updated)
  • stock_data: Array of stock modifications
  • products_multi: Array of multi-location price/barcode data
  • costs: Array of product cost data (flat associative array)
  • images_add: Array of images to add (base64 encoded)
  • images_delete: Array of image IDs to delete

For CREATE (pid NOT provided)

  • cid: 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)
  • Other product fields (optional)
  • stock_data: Initial stock data (optional)
  • products_multi: Multi-location data (optional)
  • costs: Product cost data (optional)
  • images_add: Images to add (optional)

Response

{
    "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": {}
        }
    ]
}

Example — bulk create and update

{
    "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 }
            ]
        }
    ]
}

Error Responses

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 product
  • UPDATE_FAILED: When updating the product fails
  • CREATE_FAILED: When creating the product fails
  • INVALID_STOCK_DATA: When stock data is invalid
  • PRODUCT_NOT_FOUND: When updating a product that doesn't exist