This endpoint creates new stock locations (warehouses) or updates existing ones through https://easycms.fi/public_api/set_locations/.
https://easycms.fi/public_api/set_locations/application/json
Authorization1: {API_TOKEN}username, password, account
location_id)| Parameter | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | API username |
| password | string | Yes | API password |
| account | string | Yes | Account domain |
| name | string | Yes | Location name. Must be unique per account |
| address | string | No | Street address |
| postal | string | No | Postal code |
| string | No | Contact email | |
| phone | string | No | Contact phone |
| country_id | integer | No | Country ID (defaults to 40 / Finland) |
| city_id | integer | No | City ID (defaults to 1) |
| locationNumber | integer | No | Reference number |
| parent_id | integer | No | Parent location ID |
| is_main_warehouse | integer | No | Main warehouse flag (default 0) |
| visible | integer | No | 1 = visible (default), 0 = hidden |
location_id)| Parameter | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | API username |
| password | string | Yes | API password |
| account | string | Yes | Account domain |
| location_id | integer | Yes | Location ID to update |
| name | string | No | New name (must stay unique per account) |
| address, postal, email, phone | string | No | Contact fields |
| country_id, city_id | integer | No | Reference IDs |
| locationNumber, parent_id | integer | No | References |
| is_main_warehouse | integer | No | Main warehouse flag (1/0) |
| visible | integer | No | 1 = visible, 0 = hidden |
Only the fields you provide are updated. cr_location_id is reserved for the cash-register sync and is ignored.
409 LOCATION_NAME_ALREADY_EXISTS). The cash-register sync target enforces UNIQUE(name), so a duplicate would break the nightly sync — the same guard the admin UI applies."Shelf 1", shelf_number 0) so stock operations can immediately resolve a location+shelf pair. The new shelf_id is returned in the response.country_id defaults to 40 (Finland) and city_id to 1 — both columns are required by the database.
{
"status": "success",
"message": "Location created successfully",
"data": {
"location_id": 15,
"default_shelf_id": 124,
"location": {
"location_id": "15",
"name": "Tammisto warehouse",
"address": "Kartanontie 1",
"postal": "01300",
"email": "",
"phone": "",
"locationNumber": null,
"country_id": "40",
"city_id": "1",
"parent_id": null,
"visible": "1",
"cr_location_id": null,
"is_main_warehouse": "0"
}
},
"changes": {
"location_created": {
"location_id": 15,
"name": "Tammisto warehouse",
"default_shelf_id": 124
}
}
}
Update responses carry message: "Location updated successfully" and a changes.location object with old/new values per updated field.
| HTTP Code | Error Code | Description |
|---|---|---|
| 400 | MISSING_REQUIRED_FIELDS | name missing on create |
| 400 | NOTHING_TO_UPDATE | No valid location fields provided on update |
| 409 | LOCATION_NAME_ALREADY_EXISTS | Another location already uses that name |
| 404 | LOCATION_NOT_FOUND | location_id does not exist |
| 500 | CREATE_FAILED / UPDATE_FAILED | Database write failed |
curl -X POST "https://easycms.fi/public_api/set_locations/" \
-H "Content-Type: application/json" \
-H "Authorization1: YOUR_API_TOKEN" \
-d '{
"username": "your_username",
"password": "your_password",
"account": "your_account",
"name": "Tammisto warehouse",
"address": "Kartanontie 1",
"postal": "01300"
}'
curl -X POST "https://easycms.fi/public_api/set_locations/" \
-H "Content-Type: application/json" \
-H "Authorization1: YOUR_API_TOKEN" \
-d '{
"username": "your_username",
"password": "your_password",
"account": "your_account",
"location_id": 15,
"name": "Tammisto main warehouse"
}'