Skip to content

Replace the rows of up to ten parents’ subform in one call

PUT
/orgs/{org}/connectors/{id}/records/{module}/rows
curl --request PUT \
--url https://api.sloose.com/orgs/org_9f3c/connectors/cnn_9f2a/records/Accounts/rows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "runId": "example", "field": "example", "child": "example", "automations": "example", "items": [ { "parentId": "example", "writeId": "example", "made": "example", "rows": [ { "rowKey": "example", "payload": { "additionalProperty": "example" } } ] } ] }'

Replaces the rows a subform holds in 1 to 10 parent records of {module} under an authorised run (#2438). For each parent the rows it holds now are read immediately before the write and the write deletes them and adds the sheet’s rows in ONE request, which is all or nothing for that parent. Each sheet row is metered as one plan row under its own row key in the subform’s module, naming the parent as its record; the rows of a parent are admitted together or not at all, and a refused parent releases them all, where a parent Zoho said nothing about stays counted. The answer is one result per parent, in the order sent: ok with how many rows went and came, or Zoho’s word for it relayed as an update relays it. A parent the run made (made) holds no rows, so none are read or deleted. The request is cut by the destination at about 2000 subform elements: parents past it go in a further call to the destination, never reported as refused.

org
required

The organisation id the session was issued for. A token for one organisation can never read another.

string
Example
org_9f3c

The organisation id the session was issued for. A token for one organisation can never read another.

id
required

The connector id, from GET /orgs/{org}/connectors.

string
Example
cnn_9f2a

The connector id, from GET /orgs/{org}/connectors.

module
required

The module’s API name in the destination.

string
Example
Accounts

The module’s API name in the destination.

Media typeapplication/json
object
runId

The run from POST /entitlements/runs/authorise. Required.

string
field

The parent’s field that holds the rows (the subform’s child.via). Required.

string
child

The subform’s own module, whose rows are read before the write. Required.

string
automations

Run the destination’s own automations on this write, as a batch write’s switch of the same name.

items

One to 10 parents, replaced in this order.

Array<object>
object
parentId

The parent record whose rows are replaced. Once a request. Required.

string
writeId

The engine’s id for this parent write (WriteContext.writeId), echoed in the answer. Required.

string
made

True when this run made the parent: it holds no rows, so none are read and none deleted.

rows

The sheet rows that are to be the parent’s rows, each with its row key and the subform columns it carries. Required, at least one.

Array<object>
object
rowKey
string
payload
object
key
additional properties
key
additional properties
key
additional properties
key
additional properties
Examplegenerated
{
"runId": "example",
"field": "example",
"child": "example",
"automations": "example",
"items": [
{
"parentId": "example",
"writeId": "example",
"made": "example",
"rows": [
{
"rowKey": "example",
"payload": {
"additionalProperty": "example"
}
}
]
}
]
}

One result per parent, in the order sent.

Media typeapplication/json
object
results
required
Array
Any of:
object
parentId
required
string
writeId
required
string
ok
required
boolean
deleted
required
integer
added
required
integer
Example
{
"results": [
{
"ok": true
}
]
}

No parents, more than 10 (BATCH_SIZE), more than 2000 rows, a parent without rows or a row without a key or payload, or one named twice (RECORD_REPEATED, ROW_KEY_REPEATED); or child is not the subform of that field of that module (NOT_A_SUBFORM). Nothing was admitted or sent.

Media typeapplication/json
object
error
required
string
code
string
written
boolean
key
additional properties
Example
{
"written": false
}

No bearer, or one that no longer resolves: a session that is unknown or expired (code: AUTH_REQUIRED), or an API token that was revoked or expired (TOKEN_REVOKED, TOKEN_EXPIRED), whose organisation is gone (ORG_NOT_FOUND) or whose member or user row is (MEMBERSHIP_GONE).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

The run has been stopped and nothing was written (code: RUN_STOPPED, with stop); the run is an import’s and this is not the session or token that authorised it (code: NOT_YOUR_RUN); or the bearer’s role is too low, or it was issued for a different organisation. Like every route behind a session: a session signed in but in no organisation is refused code: NO_ORG, a banned person code: BANNED, and a closed organisation code: ORG_CLOSED.

Media typeapplication/json
Any of:
object
error
required
string
code
required
string
Allowed values: RUN_STOPPED
stop
required
object
stopped
required
string
Allowed values: LIMIT_ROWS_PER_RUN
rowsPerRun
required
number
stoppedBy
required
string
Allowed values: plan declaration
rowsWrittenTotal
required
number
Example
{
"code": "RUN_STOPPED",
"stop": {
"stopped": "LIMIT_ROWS_PER_RUN",
"stoppedBy": "plan"
}
}

No such connector, or it is not visible to this session (NOT_FOUND); no such run (RUN_NOT_FOUND); or the connection has no module of that name — only its modules, as its discovery read them, are asked of the CRM (MODULE_NOT_FOUND).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

The run is not authorised to write, the run is no longer authorised, the run was authorised for a different connector (RUN_CONNECTOR_MISMATCH), or the run is an import’s and no longer holds it — its lease ran out and the import was released (LEASE_LOST).

Media typeapplication/json
object
error
required
string
key
additional properties
Examplegenerated
{
"error": "example"
}

Zoho is throttling how often this connection’s access is renewed — ten tokens from one grant in ten minutes — so nothing was sent (code: CONNECTION_THROTTLED; written: false on a write). Retry-After says when to ask again. The connection is kept: only a grant Zoho refuses ends it. A renewal throttled after the call reached Zoho is Zoho’s rate limit, relayed as a 502 with zoho.rateLimited.

Or the CRM’s API allowance for the last 24 hours is spent (zoho.quotaSpent: true, zoho.rateLimited: true, zoho.retryable: false), said one of two ways. Zoho itself refused the call (zoho.code: TOO_MANY_REQUESTS, credits left 0): relayed as this 429, never a 502, since asking again soon is refused again. Or the tenant’s gate refused it before it was sent, because Zoho had already said so: this API’s own refusal, with no zoho (code: DAILY_ALLOWANCE_SPENT; written: false on a write). Neither carries Retry-After: Zoho’s day is a rolling 24 hours and it names no time at which credits return, so Sloose lets one call a minute through to ask, and the first one answered is the allowance’s return. GET …/credits says whether the day is held spent (spent, spentAt). A system that does name its renewal is answered with Retry-After until then.

Media typeapplication/json
object
error
required
string
code
required

Why: CONNECTION_UNAVAILABLE (502) when a Zoho token for the connection will not refresh, CONNECTION_THROTTLED (429) when Zoho is throttling its renewal — ten tokens from one grant in ten minutes — and the connection is kept, and DAILY_ALLOWANCE_SPENT (429) when the connected system said a daily allowance the call draws on is spent, which waiting seconds does not bring back.

string
written

On a write: refused before the record was sent to the CRM, so nothing was written and a retry makes no second record. Absent from a read.

boolean
key
additional properties
Example
{
"written": false
}

Zoho is rate-limiting (zoho.unanswered false: nothing was done), or did not answer — it could not be reached, failed on its side, or answered without saying what it did (zoho.unanswered true: what was asked may have been done). Or this API could not use the connection before anything was sent — a Zoho token that will not refresh (code: CONNECTION_UNAVAILABLE) — and says so on a write with written: false: nothing was written.

Media typeapplication/json
Any of:
object
error
required
string
zoho
required
object
code
required
string | null
status
required
number | null
details
retryable
required
boolean
response
unanswered
required

True when Zoho gave no answer that says what was done — the connection dropped or timed out, Zoho failed on its side (a 5xx, or the same for the one record inside a 2xx), the answer was lost after its status or was not JSON, or Zoho said it made the record without saying which — so what was asked may have been done all the same: a create sent again after one may make a second record. A write that went unanswered stays counted, and its row may be written again for nothing. False when Zoho answered by declining (a 4xx, or a per-record refusal inside a 2xx), which made nothing.

boolean
rateLimited

True when Zoho asked for fewer calls and declined this one (TOO_MANY_REQUESTS): nothing was done, and the same call a little later may land — a write included, since a declined one made nothing. Absent from an older API.

boolean
retryAfterMs

How long Zoho asked to be left alone before the next call, in milliseconds, from its Retry-After; also sent as this response’s own Retry-After, in seconds. Null when it said nothing.

number | null
quotaSpent

True when the rate limit is the CRM’s daily allowance of API calls used up — a 429 whose X-API-CREDITS-REMAINING says none are left — which waiting seconds does not bring back. Without that header the two limits cannot be told apart, and this is false.

boolean
Example
{
"written": false
}

The restore switch is on (code: MAINTENANCE): every route but /health and /robots.txt is refused before anything is read, except the operator’s own POST /staff/people/{id}/delete with the ADMIN_TOKEN. Sloose is down for maintenance. Please try again in a few minutes.

Media typeapplication/json
object
error
required
string
code
required
string
Allowed value: MAINTENANCE
Example
{
"code": "MAINTENANCE"
}
Retry-After
integer

Seconds until asking again is worth it (300 while the switch is on).

Report a problem with this page

sloose.com