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/.
pid parameter is MANDATORY for all operationsattributeset_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 untouchedINVALID_ATTRIBUTE_SET_ID otherwise) — fetch valid ids from get_product_attributesattributeset_id column (the cash register carries one set per product)POST only, Content-Type: application/jsonhttps://easycms.fi/public_api/set_product_attributes/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 | Description |
|---|---|---|
pid |
integer | Product ID (MANDATORY) |
| 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 |
{
"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 }
}
}
| 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 |
# 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")