Local accounting agent connections
Read a local connection and checkpoints
/a/DataSync_get
Read the connection’s saved login state and decoded per-phase checkpoint map.
When to use this endpoint
Select an ID from DataSyncs_list. Use DataSync_getInstruction for queued work; the record ID here is a different identity.
Authentication and permissions
Use signed API-key authentication or a logged-in CRM session on the account’s routed host. API keys act as their owner; session requests require the dispatcher’s CSRF token where configured. Tenant rows and settings belong to that authenticated account.
These handlers add no accounting page or CRM2 role check. The dispatcher has no Accounting/DataSync object-scope mapping. Settings-screen access controls are separate from these shared API handlers; CRM2 screen roles are not a CRM1 API requirement.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive DataSync record ID from DataSync_new or DataSyncs_list, not an instruction ID. |
Example request
$result = FM_api('DataSync_get', ['id'=>'14']);
Example response
{
"id": "14",
"name": "Office Sage",
"sync_type": "sage50accounts",
"logged_in": "-1",
"last_checked": null
}
Database numeric values can be strings. Read the JSON error/warning fields as well as the HTTP status.
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"} | Missing, zero or negative ID. |
{"error":"DataSync does not exist"} | No matching tenant connection; no checkpoint-only placeholder is returned. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Returns a bare object with id,name,sync_type,logged_in,last_checked, without an ok wrapper. last_checked is JSON-decoded from the newest datasyncLastChecked<ID> setting ordered cdate DESC,id DESC; missing/invalid JSON yields null.
- logged_in is stored agent state: a newly created test connection returns -1; login queues only when it is 0, logout queues only when it is 1. It is not calculated from a live agent heartbeat.
- No local-type restriction is applied, so historical cloud records remain readable. No secret, catalogue or instruction list is returned.
Side effects
- Database reads only; does not update last-checked timestamps or contact the agent.
See it in Fieldmotion
CRM1
Open Settings → Data Sync. The pageSettingsDataSync screen uses this route for the operation described above; filter browser Network requests by the exact function name. Local-agent setup is separate from the cloud Finance integrations. Select a saved connection tab; the UI loads logged_in and last_checked.
CRM2
Open Settings → Data Sync. The CRM2 pageSettingsDataSync screen retains this local-agent workflow; filter browser Network requests by the exact function name. Its screen permissions do not add a role check to this shared handler. Select a saved connection tab; the UI loads logged_in and last_checked.
Related endpoints
DataSyncs_list— Select a saved connection ID.DataSync_getInstruction— Poll the instruction ID.DataSync_login— Queue agent login.