Inventory & Products | Products | Attributes | Set Product Attributes

Setting Product Attributes

This document outlines the procedure for making API calls to attach attribute sets to a product and set its ask-at-sale flag via https://easycms.fi/public_api/set_product_attributes/.

Important Notes

  • All parameters marked as MANDATORY are required
  • The pid parameter is MANDATORY for all operations
  • This endpoint manages the product's attachments — attribute-set definitions (sets, attributes, values) are maintained in the CMS product editor's Attributes tab, not through the API
  • attributeset_ids works as REPLACE-ALL: the product's attached sets become exactly the posted list, in the posted order; an empty array detaches every set. Omit the key entirely to leave attachments untouched
  • Every posted set id must exist (INVALID_ATTRIBUTE_SET_ID otherwise) — fetch valid ids from get_product_attributes
  • The first set of the list is mirrored to the product's legacy attributeset_id column (the cash register carries one set per product)
  • Attachments are diff-saved: unchanged sets are not rewritten
  • Like every public-api product setter this writes the CMS database only — no cash-register push happens here
  • POST only, Content-Type: application/json

Endpoint and Method

  • Endpoint: https://easycms.fi/public_api/set_product_attributes/
  • 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.

Required Parameters (for all operations)

Parameter Type Description
pid integer Product ID (MANDATORY)

Optional Parameters (at least one required)

Parameter Type Description
attributeset_ids array of UUIDs (or comma-separated string) REPLACE-ALL list of attribute-set ids in attachment order. Key present + empty array = detach all. Key absent = leave attachments untouched
isverpatrib 1/0 Ask for attribute values when the product is added to order/invoice lines



Successful Response

{
  "success": true,
  "message": "Product attributes updated successfully",
  "action": "set_attachments+set_flag",
  "data": {
    "pid": 25327,
    "attributeset_ids": ["f37c7663-1a60-4134-ac48-75bd3f27b3e1"],
    "attributeset_id": "f37c7663-1a60-4134-ac48-75bd3f27b3e1",
    "isverpatrib": 1
  },
  "changes": {
    "isverpatrib": { "old": 0, "new": 1 },
    "attachments": { "inserted": 1, "deleted": 0, "unchanged": 0 }
  }
}

Errors

error_code When
MISSING_PID / PRODUCT_NOT_FOUND pid missing, unknown or deleted
INVALID_ATTRIBUTESET_IDS attributeset_ids is neither array nor CSV string
INVALID_ATTRIBUTE_SET_ID one or more set ids do not exist (list included in message)
INVALID_BOOLEAN_VALUE isverpatrib not 1/0 or true/false
NO_FIELDS_TO_UPDATE neither attributeset_ids nor isverpatrib posted
SYNC_FAILED diff-save failed — previous state intact



Call Examples in Different Languages


# Attach two sets (in order) and enable ask-at-sale
curl -X POST 'https://easycms.fi/public_api/set_product_attributes' \
-H 'Authorization1: TOKEN' \
-H 'Content-Type: application/json' \
-d '{
  "username": "USERNAME",
  "password": "PASSWORD",
  "account": "ACCOUNT_ID",
  "pid": 25327,
  "attributeset_ids": ["f37c7663-1a60-4134-ac48-75bd3f27b3e1", "9c2e08d1-4b77-4a09-9d21-6f0b3e5a7c44"],
  "isverpatrib": 1
}'

# Detach every set
curl -X POST 'https://easycms.fi/public_api/set_product_attributes' \
-H 'Authorization1: TOKEN' \
-H 'Content-Type: application/json' \
-d '{
  "username": "USERNAME",
  "password": "PASSWORD",
  "account": "ACCOUNT_ID",
  "pid": 25327,
  "attributeset_ids": []
}'

# Only flip the ask-at-sale flag (attachments untouched)
curl -X POST 'https://easycms.fi/public_api/set_product_attributes' \
-H 'Authorization1: TOKEN' \
-H 'Content-Type: application/json' \
-d '{
  "username": "USERNAME",
  "password": "PASSWORD",
  "account": "ACCOUNT_ID",
  "pid": 25327,
  "isverpatrib": 0
}'

$ch = curl_init('https://easycms.fi/public_api/set_product_attributes');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization1: TOKEN', 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => json_encode([
        'username' => 'USERNAME',
        'password' => 'PASSWORD',
        'account'  => 'ACCOUNT_ID',
        'pid'      => 25327,
        'attributeset_ids' => ['f37c7663-1a60-4134-ac48-75bd3f27b3e1'],
        'isverpatrib' => 1
    ])
]);
$response = json_decode(curl_exec($ch), true);
// $response['changes']['attachments'] = inserted/deleted/unchanged

const res = await fetch('https://easycms.fi/public_api/set_product_attributes', {
  method: 'POST',
  headers: { 'Authorization1': 'TOKEN', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    username: 'USERNAME', password: 'PASSWORD', account: 'ACCOUNT_ID',
    pid: 25327,
    attributeset_ids: ['f37c7663-1a60-4134-ac48-75bd3f27b3e1'],
    isverpatrib: 1
  })
});
const data = await res.json();
// data.data.attributeset_ids = final attachment order

val body = """{"username":"USERNAME","password":"PASSWORD",
  "account":"ACCOUNT_ID","pid":25327,
  "attributeset_ids":["f37c7663-1a60-4134-ac48-75bd3f27b3e1"],
  "isverpatrib":1}"""
val req = Request.Builder()
    .url("https://easycms.fi/public_api/set_product_attributes")
    .header("Authorization1", "TOKEN")
    .post(body.toRequestBody("application/json".toMediaType()))
    .build()
val data = JSONObject(client.newCall(req).execute().body!!.string())
// data.getJSONObject("data").getJSONArray("attributeset_ids")