4. Operation rules
4.1 Get
Section titled “4.1 Get”4.1.1 Operation get
Section titled “4.1.1 Operation get”SUB_ID MUST
Client MUST send a single Resource ID in the Subject.
RES_RESOURCES_FOUND MUST
Server MUST return the Resources matched by the Subject.
If no Resource matches the Resource ID, the Server MUST fail the operation with the NOT_FOUND error.
PARAM_PROJECTION MAY
Client MAY send a Projection Parameter.
4.2 List
Section titled “4.2 List”4.2.1 Operation list
Section titled “4.2.1 Operation list”SUB_SEARCH_QUERY MUST
If the Client specifies a Subject, it MUST be a Search Query as defined in Section 3.2.1 Definition and representation. CRUD Participants MUST negotiate the Search Query format as specified in 3.4.1 Content negotiation.
SUB_EMPTY MAY
The Client MAY omit the Subject. In this case, every Resource of the Collection matches, subject to pagination.
Rule RES_RESOURCES_FOUND MUST defined in section 4.1.1
Server MUST return the Resources matched by the Subject.
RES_NO_RESULTS MUST
If no Resource matches the Search Query, the Server MUST NOT fail the operation: read operations return an empty list and write operations modify nothing, with a Modified Count of 0.
PARAM_PAGINATION MAY
Client MAY send a Pagination Parameter.
PARAM_CUSTOM MAY
Client MAY send a Custom Parameter.
Rule PARAM_PROJECTION MAY defined in section 4.1.1
Client MAY send a Projection Parameter.
PARAM_SORTING MAY
Client MAY send a Sorting Parameter.
4.2.3 Sorting Parameter
Section titled “4.2.3 Sorting Parameter”A “Sorting Parameter” determines the order of the Results of list operations.
SORTING_FIELD_LIST MUST
A Sorting Parameter MUST be a field list (section 3.3.1), where the - modifier means descending order and Fields without it are sorted in ascending order. The Server MUST sort by each Field in the order of the list.
SORTING_NULLS MUST
null and missing Fields MUST be sorted as lower than any other value, so they come first in ascending order and last in descending order.
SORTING_DEFAULT SHOULD
Without a Sorting Parameter, the Server SHOULD sort by Resource ID, and it SHOULD add the Resource ID as the last sorting key, so that pages are stable.
4.2.4 Pagination Parameters
Section titled “4.2.4 Pagination Parameters”“Pagination Parameters” split the Results of list operations into pages. There are three ways to paginate, all with a limit, the maximum number of Resources per page.
| Way | Parameters | Best for |
|---|---|---|
| Page | page (starting at 1) and limit |
screens and charts that jump to a page |
| Offset | offset (number of Resources to skip, starting at 0, also called skip) and limit |
clients that compute positions |
| Cursor | cursor (an opaque token returned by the previous page) and limit |
large Collections, where skipping many Resources is slow |
PAGINATION_PAGE SHOULD
A Server that paginates SHOULD support the page and limit Parameters.
A Server MAY support the offset and limit Parameters.
A Server MAY support cursor pagination. When it does, the Result metadata MUST include the cursor of the next page, or indicate that there is no next page, and the cursor MUST be opaque to the Client.
PAGINATION_EXCLUSIVE MUST
page, offset and cursor MUST NOT be combined in the same operation; the Server MUST fail if they are.
A Server MAY cap limit and MAY apply a default limit when the Client sends none. When it reduces the limit sent by the Client, it MUST report the LIMIT_REDUCED Warning.
4.2.5 Custom Parameters
Section titled “4.2.5 Custom Parameters”Custom Parameters are defined in section 3.3.3.
4.3 Create
Section titled “4.3 Create”4.3.1 Operation create
Section titled “4.3.1 Operation create”SUB_RESOURCES_CREATE MUST
Client MUST send either a single Resource or a list of multiple Resources.
SUB_WITH_IDS MAY
The Client MAY send Resources with Resource IDs, in a type the Server accepts for the Collection.
Server MUST return the Resource(s) that were the subject of the operation (created, modified, or replaced).
RES_WITH_IDS MUST
Resource IDs MUST be returned with their Resources
RES_NO_IDS MUST
If the Server cannot create Resources with the Resource IDs sent by the Client, the operation MUST fail with the NEGOTIATION error.
RES_CONFLICT MUST
If a Resource ID sent by the Client already exists in the Collection, the Server MUST fail the operation with the CONFLICT error.
RES_DETERMINISTIC_WRITES SHOULD
When the Subject has several Resources, the Server SHOULD return the Result in the same order as the Subject. If it cannot, it MUST report the ORDER_NOT_PRESERVED Warning.
Client MAY send a Projection Parameter in order to reduce redundancy of Resources returned in the Result.
4.3.2 Operation clone
Section titled “4.3.2 Operation clone”clone is a shorthand for creating a copy of an existing Resource with a new Resource ID.
SUB_CLONE MUST
The Client MUST send the Resource ID of the source Resource. The Client MAY also send a patch (as in SUB_JSON_PATCH and SUB_MERGE_PATCH) to apply to the copy, and MAY send the Resource ID of the copy.
RES_CLONE MUST
The Server MUST create a new Resource in the same Collection with the Fields of the source Resource, apply the patch if one was sent, and assign it a new Resource ID (or the one sent by the Client). Reserved Fields defined by extensions follow the rules of each extension.
Rule RES_MATCHING_REQUIRED MUST defined in section 4.1.1
If no Resource matches the Resource ID, the Server MUST fail the operation with the NOT_FOUND error.
Rule RES_RESOURCES_WRITTEN MUST defined in section 4.3.1
Server MUST return the Resource(s) that were the subject of the operation (created, modified, or replaced).
Rule RES_CONFLICT MUST defined in section 4.3.1
If a Resource ID sent by the Client already exists in the Collection, the Server MUST fail the operation with the CONFLICT error.
Rule PARAM_PROJECTION_WRITE MAY defined in section 4.3.1
Client MAY send a Projection Parameter in order to reduce redundancy of Resources returned in the Result.
4.4 Patch
Section titled “4.4 Patch”4.4.1 Operation patchById
Section titled “4.4.1 Operation patchById”Rule SUB_ID MUST defined in section 4.1.1
Client MUST send a single Resource ID in the Subject.
SUB_JSON_PATCH MUST
The Client MUST send the patch as a JSON Patch (RFC 6902) document. If the patch is malformed or cannot be applied, the Server MUST fail the operation with the INVALID_PATCH error.
SUB_MERGE_PATCH MAY
The Server MAY also accept the patch as a JSON Merge Patch (RFC 7396) document, negotiated with the application/merge-patch+json media type.
Rule RES_RESOURCES_WRITTEN MUST defined in section 4.3.1
Server MUST return the Resource(s) that were the subject of the operation (created, modified, or replaced).
Rule RES_MATCHING_REQUIRED MUST defined in section 4.1.1
If no Resource matches the Resource ID, the Server MUST fail the operation with the NOT_FOUND error.
Rule PARAM_PROJECTION_WRITE MAY defined in section 4.3.1
Client MAY send a Projection Parameter in order to reduce redundancy of Resources returned in the Result.
4.4.2 Operation patchByQuery
Section titled “4.4.2 Operation patchByQuery”Client MUST send a Search Query as defined in Section 3.2.1 Definition and representation in the Subject. CRUD Participants MUST negotiate the Search Query format as specified in 3.4.1 Content negotiation.
Rule SUB_JSON_PATCH MUST defined in section 4.4.1
The Client MUST send the patch as a JSON Patch (RFC 6902) document. If the patch is malformed or cannot be applied, the Server MUST fail the operation with the INVALID_PATCH error.
Rule SUB_MERGE_PATCH MAY defined in section 4.4.1
The Server MAY also accept the patch as a JSON Merge Patch (RFC 7396) document, negotiated with the application/merge-patch+json media type.
Rule RES_RESOURCES_WRITTEN MUST defined in section 4.3.1
Server MUST return the Resource(s) that were the subject of the operation (created, modified, or replaced).
Rule RES_NO_RESULTS MUST defined in section 4.2.1
If no Resource matches the Search Query, the Server MUST NOT fail the operation: read operations return an empty list and write operations modify nothing, with a Modified Count of 0.
Rule PARAM_PROJECTION_WRITE MAY defined in section 4.3.1
Client MAY send a Projection Parameter in order to reduce redundancy of Resources returned in the Result.
The Client MAY send an “Expect Match” Parameter with the number of Resources the Search Query is expected to match. The Server MUST check it before writing anything and, if the matched count differs, MUST fail the operation with the EXPECT_MISMATCH error without modifying any Resource.
4.5 Replace
Section titled “4.5 Replace”4.5.1 Operation replaceById
Section titled “4.5.1 Operation replaceById”SUB_ID_REPLACE MUST
The Subject MUST contain the Resource ID of the Resource to replace, inside the replacement Resource or separately. If both are present and differ, the Server MUST fail the operation with the INVALID_INPUT error.
SUB_RESOURCE_REPLACE MUST
Client MUST send a new Resource to replace the original Resource(s) matched
Rule RES_RESOURCES_WRITTEN MUST defined in section 4.3.1
Server MUST return the Resource(s) that were the subject of the operation (created, modified, or replaced).
RES_UPSERT_PREVENTED MUST
If no Resource has the Resource ID and the Client denied upserts (PARAM_DENY_UPSERT), the Server MUST fail the operation with the UPSERT_DENIED error.
Rule PARAM_PROJECTION_WRITE MAY defined in section 4.3.1
Client MAY send a Projection Parameter in order to reduce redundancy of Resources returned in the Result.
Client MAY send a “Deny Upsert” Parameter to explicitly indicate that the Server MUST NOT create a new Resource if the Resource ID is not found in the Collection.
META_UPSERTED MUST
If the Resource ID is not found during the operation and the Server creates the Resource, the Server MUST send an “Upserted” Metadata indicating the Resource was created instead of replaced.
4.5.2 Operation replaceByQuery
Section titled “4.5.2 Operation replaceByQuery”Rule SUB_SEARCH_QUERY_WRITE MUST defined in section 4.4.2
Client MUST send a Search Query as defined in Section 3.2.1 Definition and representation in the Subject. CRUD Participants MUST negotiate the Search Query format as specified in 3.4.1 Content negotiation.
Rule SUB_RESOURCE_REPLACE MUST defined in section 4.5.1
Client MUST send a new Resource to replace the original Resource(s) matched
REPLACE_QUERY_EACH MUST
The Server MUST replace each Resource matched by the Search Query with the replacement Resource, keeping the Resource ID of each one, and MUST NOT create Resources (no upsert).
SUB_NO_ID SHOULD
The replacement Resource SHOULD NOT include a Resource ID. If it does, the Server MUST ignore it, keep the Resource ID of each matched Resource, and report the ID_IGNORED Warning.
Rule RES_RESOURCES_WRITTEN MUST defined in section 4.3.1
Server MUST return the Resource(s) that were the subject of the operation (created, modified, or replaced).
Rule RES_NO_RESULTS MUST defined in section 4.2.1
If no Resource matches the Search Query, the Server MUST NOT fail the operation: read operations return an empty list and write operations modify nothing, with a Modified Count of 0.
Rule PARAM_PROJECTION_WRITE MAY defined in section 4.3.1
Client MAY send a Projection Parameter in order to reduce redundancy of Resources returned in the Result.
Rule PARAM_EXPECT_MATCH MAY defined in section 4.4.2
The Client MAY send an “Expect Match” Parameter with the number of Resources the Search Query is expected to match. The Server MUST check it before writing anything and, if the matched count differs, MUST fail the operation with the EXPECT_MISMATCH error without modifying any Resource.
4.6 Delete
Section titled “4.6 Delete”4.6.1 Operation deleteById
Section titled “4.6.1 Operation deleteById”Rule SUB_ID MUST defined in section 4.1.1
Client MUST send a single Resource ID in the Subject.
RES_EMPTY MUST
Delete operations MUST behave as if the Client declared the minimal return preference when it declares none: the Server returns no Resources. When the Client declares representation, the Server MUST return the deleted Resources.
Rule RES_MATCHING_REQUIRED MUST defined in section 4.1.1
If no Resource matches the Resource ID, the Server MUST fail the operation with the NOT_FOUND error.
4.6.2 Operation deleteByQuery
Section titled “4.6.2 Operation deleteByQuery”Rule SUB_SEARCH_QUERY_WRITE MUST defined in section 4.4.2
Client MUST send a Search Query as defined in Section 3.2.1 Definition and representation in the Subject. CRUD Participants MUST negotiate the Search Query format as specified in 3.4.1 Content negotiation.
Rule RES_EMPTY MUST defined in section 4.6.1
Delete operations MUST behave as if the Client declared the minimal return preference when it declares none: the Server returns no Resources. When the Client declares representation, the Server MUST return the deleted Resources.
Rule RES_NO_RESULTS MUST defined in section 4.2.1
If no Resource matches the Search Query, the Server MUST NOT fail the operation: read operations return an empty list and write operations modify nothing, with a Modified Count of 0.
Rule PARAM_EXPECT_MATCH MAY defined in section 4.4.2
The Client MAY send an “Expect Match” Parameter with the number of Resources the Search Query is expected to match. The Server MUST check it before writing anything and, if the matched count differs, MUST fail the operation with the EXPECT_MISMATCH error without modifying any Resource.
4.7 Writes on several Resources
Section titled “4.7 Writes on several Resources”A write operation may affect several Resources: create with a list, and the ByQuery operations. This section defines what happens when some of them fail.
WRITE_MODIFIED_COUNT MUST
A write operation on several Resources MUST always report the Modified Count (META_MODIFIED_COUNT), whether it succeeds or fails.
WRITE_ATOMIC_STRICT MUST
When the Client declared the strict preference (META_WARN_PREFERENCE), a write operation on several Resources MUST be atomic: either every Resource is written or none is. A Server that cannot guarantee atomicity for the Collection MUST fail with the UNSUPPORTED error before writing anything.
WRITE_ATOMIC_TRANSACTIONAL MUST
When the Data source supports transactions, a write operation on several Resources MUST be atomic: if any Resource cannot be written, the operation MUST fail and no Resource is written.
WRITE_PARTIAL MAY
Otherwise, a write operation on several Resources MAY be partial: the Server writes the Resources it can, returns them in the Result, and reports each Resource it could not write as a WRITE_FAILED Warning, with the error code and, when known, the Resource ID.
WRITE_ATOMICITY_DECLARE SHOULD
A Server SHOULD declare, for each Collection, whether writes on several Resources are atomic.
| Data source | Strict preference | Behavior |
|---|---|---|
| Transactional (PostgreSQL) | any | atomic: any failure fails the operation, nothing is written |
| Not transactional (Notion, Airtable) | strict | UNSUPPORTED, nothing is written |
| Not transactional (Notion, Airtable) | not strict | partial: written Resources in the Result, failures as Warnings |
Source: lingodata/crud@bc225ba · specs/base/sections/04-operation-rules.md · base 0.2.0 (draft)
LingoData specifications, reference implementations and this site are licensed under the Apache License 2.0. Copyright 2026 Gustavo Gondim.