Publish an operation result
Publish changes and save an operation receipt in one atomic step. When a receipt already exists for the same project operation and input, the response contains that receipt. The saved receipt applies to all later requests, from all callers. Each request is authenticated and authorized again. You must have permission to publish to the project and to change each resource.
bearerAuthAuthorizationBearer <token>project_id*stringOwning project identifier. Nonempty, at most 128 UTF-8 bytes, with no control characters. Project creation belongs to the project service.
application/json- body
Publish at most once for operationId and input. A retry with the same input returns the saved publication and preserves the first completed result, even if a later caller supplies a different result. Different input for an existing operation is rejected. Input comparison ignores JSON object key order and preserves array element order. Unlike ordinary publication, empty change lists may save a durable result without resource changes.
operation*Opaque JSON operation input and completed result saved atomically with publication. Catalog does not interpret resource-specific payloads. Operation identity is project-scoped and independent of transaction and caller identity. Precision-sensitive numbers in opaque JSON should be encoded as strings for cross-language portability.
publication*Atomic entry-wise publication against a stable branch identity. baseCommitId must be an ancestor of its current head. Compare only submitted domains, permitting disjoint changes since the base; expectedHeadCommitId additionally requires an exact current head. Lists are required, may be empty individually, and are bounded to 1000 entries each. At least one mutation or assertion is required. Assertions participate in conflict checking; an assertion-only publication records a commit. Messages are at most 16384 UTF-8 bytes. The service authenticates the actor, checks state-read permission for assertions including absent resources, and checks resource-kind mutation permissions for all mutated and bound identities.
Success
application/json- response
A successful operation publication returns the winning receipt, including its original saved result and publication identities. Candidates with the same input do not replace an existing receipt. Conflicts publish no operation result.
conflict*type*unknowncurl -X POST 'https://api.spiraldb.dev/api/catalog/projects/string/operations/publish' \ -H 'Content-Type: application/json' \ -d '{ "operation": { "input": null, "operationId": "3051932a-fdd2-48fa-b330-7e7d41535969", "result": null }, "publication": { "baseCommitId": "444e6d44-c77c-4d6f-9c8c-82cfd8252d0c", "branchId": "712f308d-801e-48bc-b072-9c404734ceb7", "idempotencyKey": "string", "namespace": [ { "assert": { "name": "string", "parent": { "prefix": { "path": [ "string" ] }, "type": "prefix" } }, "type": "assert" } ], "resources": [ { "advance": { "expected": "cc46ff75-488a-4f5d-9162-1798e46c1fcc", "replacement": "0d5797a7-50c5-42e4-893d-e90cf0476063", "resourceId": "026d60bb-63a8-407e-bf67-01dcfc6022e6" }, "type": "advance" } ], "transactionId": "75906707-8c31-479c-b354-aa805c4cefbc" }}'{ "conflict": { "constraints": [ { "ambiguousBinding": { "name": "string", "parent": { "prefix": { "path": [ "string" ], "resourceId": "026d60bb-63a8-407e-bf67-01dcfc6022e6" }, "type": "prefix" } }, "type": "ambiguousBinding" } ], "currentCommitId": "d860b6df-6923-4a82-a83e-5fa7b3ce8ada", "namespace": [ { "current": "b6f6f63e-cd8b-43b2-a95a-2087cb7f8e11", "expected": "cc46ff75-488a-4f5d-9162-1798e46c1fcc", "name": "string", "parent": { "prefix": { "path": [ "string" ], "resourceId": "026d60bb-63a8-407e-bf67-01dcfc6022e6" }, "type": "prefix" } } ], "resources": [ { "current": "b6f6f63e-cd8b-43b2-a95a-2087cb7f8e11", "expected": "cc46ff75-488a-4f5d-9162-1798e46c1fcc", "resourceId": "026d60bb-63a8-407e-bf67-01dcfc6022e6" } ] }, "type": "conflict"}