PUT https://{subdomain}.daftra.com/v2/api/entity/unit_template/{id}/v2/api/entity/unit_template without an id is thePOST (create). A PUT there returns405 The PUT method is not supported for route api/entity/unit_template. Supported methods: POST./ is answered with a 301 to the same URL without it,301 — the call arrivesGET and you get a misleading "The GET method is not supported" error. Never combinecurl --location with --request PUT.Authorization: Bearer <access_token> from the OAuth password grant. The apikey header belongs to/api2 API and is ignored on this surface.id in the body is what makes this an update. Omit it and the request inserts a new record{id} in the URL does not prevent that. Always send id, matching the URL.active, which is a checkbox: omitting it stores 0. Send it on every update.branch_id and staff_id are assigned by the server (auto-branch / auto-staff) and ignored if sent.created / modified are read-only.unit_templates_unit_factors (parent table + subform name). unit_factorsid is updated, a row without id is| Code | Body | When |
|---|---|---|
| 200 | {message, id} | Saved. message is localised to the site language — match on the status and id, not the text. |
| 400 | {message} or {message, errors} | Record not found for an unknown id, or Entity not saved with per-field errors. |
| 401 | {error} | Caller lacks the update permission for this entity. |
| 405 | {message} | Wrong method for the path — usually a missing id or a followed trailing-slash redirect (see URL rules). |
curl --location --globoff --request PUT 'https://.daftara.com/api2/unit_template/2' \
--header 'Accept: application/json' \
--header 'apikey: ' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"id": 2,
"template_name": "Weight (updated)",
"active": 1,
"main_unit_name": "gram",
"unit_small_name": "g",
"unit_templates_unit_factors": [
{
"id": 4,
"factor_name": "Kilogram",
"factor": 1000,
"small_name": "kg"
},
{
"factor_name": "Tonne",
"factor": 1000000,
"small_name": "t"
}
]
}'{
"message": " Unit Template Updated Successfully",
"id": 2
}