Skip to content

Curate one module

PATCH
/orgs/{org}/config/modules/{module}
curl --request PATCH \
--url 'https://api.sloose.com/orgs/org_9f3c/config/modules/accounts?connector=con_8f2a' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'If-Match: "7"' \
--data '{ "seedMappings": "example", "key": "example", "singular": "example", "label": "example", "enabled": true, "position": 1, "color": "example", "defaultEnabled": true, "uniqueFields": [ "example" ], "defaultDuplicateCheck": { "searchField": "example", "searchMethod": "example", "expression": "example" }, "excludedFields": [ "example" ] }'

Enable it, rename it, set its singular, choose its unique fields and match defaults, or exclude fields. Every field is optional; only what you send changes. A module an administrator removed after it went from the CRM is not found: it is on none of the connection’s pages, and it comes back as it was if the CRM offers it again.

A mapping a new import starts from is the FIELD’s, not the module’s: PATCH /orgs/{org}/config/fields/{module}/{apiName} with a defaultMapping. It was seedMappings here until the two were folded together, and a body still carrying that key is refused rather than quietly ignored.

org
required

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

string
Example
org_9f3c

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

module
required

The module’s key or CRM API name — either is accepted.

string
Example
accounts

The module’s key or CRM API name — either is accepted.

connector

The connection this is about, by id: one of the org’s, or your own. REQUIRED: absent or empty is 400 CONNECTION_REQUIRED, listing the connections this bearer may name, because nothing picks one for a request that does not say (design §14.8). Any other — another org’s, or another person’s — is 404 CONNECTION_NOT_FOUND.

string
Example
con_8f2a

The connection this is about, by id: one of the org’s, or your own. REQUIRED: absent or empty is 400 CONNECTION_REQUIRED, listing the connections this bearer may name, because nothing picks one for a request that does not say (design §14.8). Any other — another org’s, or another person’s — is 404 CONNECTION_NOT_FOUND.

If-Match

The registryVersion this change was made against, as "7" or 7 — a weak tag (W/"7") is refused, since If-Match uses strong comparison. Sent, the write is refused with 409 (code: REGISTRY_CONFLICT, the current version in the body) when the org has moved since, and otherwise answers the version it made: one past the version sent for a write made in one transaction, or the version sent itself for a request that asks for no change (an empty PATCH /config/writing), since it makes none. A bundle (POST /config/bundle) is several transactions and only its first waits on this version: it answers the version its own bumps took the org to, and none — nor an etag — when another write landed between them; one landing after them, while its templates are saved, withholds the etag alone. Omitted, there is no condition, and * is no condition either — and a write with no condition answers no registryVersion (nor, from a bundle, an etag), since nothing says which version it was made from. A value that is neither is 400 (code: BAD_IF_MATCH) rather than ignored — a precondition silently dropped looks like conflict detection and is not.

string
Example
"7"

The registryVersion this change was made against, as "7" or 7 — a weak tag (W/"7") is refused, since If-Match uses strong comparison. Sent, the write is refused with 409 (code: REGISTRY_CONFLICT, the current version in the body) when the org has moved since, and otherwise answers the version it made: one past the version sent for a write made in one transaction, or the version sent itself for a request that asks for no change (an empty PATCH /config/writing), since it makes none. A bundle (POST /config/bundle) is several transactions and only its first waits on this version: it answers the version its own bumps took the org to, and none — nor an etag — when another write landed between them; one landing after them, while its templates are saved, withholds the etag alone. Omitted, there is no condition, and * is no condition either — and a write with no condition answers no registryVersion (nor, from a bundle, an etag), since nothing says which version it was made from. A value that is neither is 400 (code: BAD_IF_MATCH) rather than ignored — a precondition silently dropped looks like conflict detection and is not.

Media typeapplication/json
object
seedMappings

seedMappings is no longer a module setting: a mapping a new import starts from belongs to the field it is about. Set defaultMapping on the field annotation — PATCH /orgs/{org}/config/fields/{module}/{apiName}, or fields/<module>.json in a configuration repository. Values already stored were moved by migration 0035.

key

The name this module goes by in expressions and mappings.

string
/^[a-z][a-z0-9_]*$/
singular

The rec.<Singular> name used in expressions.

string
/^[A-Za-z_$][\w$]*$/
label
string
>= 1 characters
enabled
boolean
position
integer
color
string | null
defaultEnabled
boolean
uniqueFields
Array<string> | null
defaultDuplicateCheck
object
searchField
string
searchMethod
string
expression
string
excludedFields

Fields of this module to exclude from mapping. SUGAR since connections: it sets excluded on the named fields and never clears one; offer a field again through its own annotation.

Array<string> | null
Examplegenerated
{
"seedMappings": "example",
"key": "example",
"singular": "example",
"label": "example",
"enabled": true,
"position": 1,
"color": "example",
"defaultEnabled": true,
"uniqueFields": [
"example"
],
"defaultDuplicateCheck": {
"searchField": "example",
"searchMethod": "example",
"expression": "example"
},
"excludedFields": [
"example"
]
}

The module as it now stands.

Media typeapplication/json
object
module
required

A discovered CRM module with the org’s curation applied.

object
id
required
string
key
required
string
apiName
required
string
singular
required
string | null
enabled
required
boolean
present
required

False once discovery stops seeing the module in the CRM.

boolean
position
required
number | null
goneAt

When discovery stopped seeing the module in the CRM. Null while it is present, and for a module that went before Sloose kept the date and had no field to date it by.

string | null
fieldCount

How many fields the connection holds for the module — the ones the registry counts as present, which is what an import maps against and what the Connections pages say beside it, so they need not read every field. It is the registry’s, not the last read’s: a read that lists no fields for a module, or fails for it, leaves the fields the module already had in place (discovery errs that way on purpose), so the count stays with them. Present on the module list only (GET /orgs/{org}/config/modules), at the version it answers. Absent for a module with none (never read, or gone from the CRM).

number
removedAt

When an administrator removed the module (DELETE /orgs/{org}/config/modules/{module}), which only a module gone from the CRM can be: its fields are forgotten, and it is listed here so that an import or a template set up for it keeps that setup aside. Null for one nobody removed, and again once the CRM offers it back.

string | null
key
additional properties
registryVersion

The version the org is at after this write, to send as the next write’s If-Match: one past the version you sent in If-Match for a write made in one transaction (a bundle, several, answers the version its own bumps took the org to, or none when another write landed between them), or that version itself for a request that asks for no change (an empty PATCH /config/writing, which writes nothing and makes no version; sending the value the org already has still writes, and moves it). Only a write sent with a version in If-Match answers one. Without (no header, or *), the write lands on whatever version the org is at, and nothing on the server knows which version your picture of the configuration was built from: another administrator’s change may be inside the number, and sent back as If-Match it would let your next write overwrite that change unseen. So it is left out. To write again, read the configuration first (its GET answers the version), or send If-Match.

number
Examplegenerated
{
"module": {
"id": "example",
"key": "example",
"apiName": "example",
"singular": "example",
"enabled": true,
"present": true,
"position": 1,
"goneAt": "example",
"fieldCount": 1,
"removedAt": "example"
},
"registryVersion": 1
}

The request — its body or its query — did not match the schema (issues carries the Zod issue list), or: The request named no connection (code: CONNECTION_REQUIRED, with connections: the ones this bearer may name). Nothing picks one for a request that does not say (design §14.8).

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"
}

No bearer, or one that is expired, revoked or no longer resolves to a member.

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 bearer’s role is too low, or it was issued for a different org.

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"
}

No such module or connection, or it is not visible to this session.

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 org’s configuration has changed since the version in If-Match; the current one is in the body.

Media typeapplication/json
object
error
required
string
code
required
string
Allowed values: REGISTRY_CONFLICT
registryVersion
required
number
key
additional properties
Example
{
"code": "REGISTRY_CONFLICT"
}

Another module already uses that key or singular.

Media typeapplication/json
object
error
required
string
code
required
string
Allowed values: KEY_CLASH
key
additional properties
Example
{
"code": "KEY_CLASH"
}

Report a problem with this page