Schedule of Rates
Set Schedule of Rates archive state
/a/ScheduleOfRates_setArchived
Set the legacy archive flag for one Schedule of Rates ID.
When to use this endpoint
Use ScheduleOfRates_setArchived for CRM1’s archive/unarchive action. CRM2 updates the same field through ScheduleOfRate_updateData.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler calls the normal login guard but performs no additional page or role-permission check.
All reads and writes use the authenticated tenant. The CRM screens apply client-side Schedule of Rates permissions, but those controls are not repeated by this endpoint.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Positive tenant-local rate ID. |
archived | Integer string | Yes in practice | Integer value stored without restricting it to 0/1. Omission is not validated and is coerced toward 0 with a runtime notice. |
Example request
FM_api('ScheduleOfRates_setArchived', [
'id' => '430001',
'archived' => 1,
]);
Example response
{
"ok": 1
}
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"missing or invalid parameter: id"} | The ID is absent or not positive. |
{"ok":1} | The positive ID does not exist; absence is not reported. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Always executes the update, advances
last_edited, and returns success; it does not detect a no-op. - Archive state affects only callers that filter or visually suppress it. The legacy list route still returns archived rows.
Side effects
- Advances the
scheduleOfRatescache marker. - Fires the tenant-configurable
SOR_editevent with the rate ID. Any configured listeners run synchronously and can add integration-specific side effects.
See it in Fieldmotion
CRM1
The Archive/Unarchive action on the Schedule of Rates page calls this route.
CRM2
CRM2 sends archived through ScheduleOfRate_updateData, including bulk changes.
Related endpoints
ScheduleOfRate_updateDatais CRM2’s mapped alternative.ScheduleOfRates_deletepermanently removes a row.