Coelevate Documentation
API ReferenceContext Repository

Decide one staged op

Approves or rejects one op of the open changeset, or returns it to undecided.

POST /context/v1/changeset/ops/{op_id}/decision

Approves or rejects one op of the open changeset, or returns it to undecided. Only approved ops are published by a merge. Rejecting an op also rejects every op that depends on it, listed in cascaded_op_ids. Approving an op whose dependency is rejected or undecided is a 409 naming it. The ops of one asset, or of one relationship, are one review item, and naming one op here decides every op of its item (decided_op_ids lists them all). To decide exactly the ops you name, use POST changeset/decisions, which refuses an item you name only part of. Send expected_revision so a decision never lands on a changeset that moved after you read it. Needs the review scope, which a key that can only stage does not hold.

Requires the context:review scope.

Parameters

ParameterLocationRequiredDescription
op_idpathyesThe id of the op, as GET changeset lists it.

Request body

FieldTypeRequiredDescription
decisionstring, one of approved, rejected, undecidedyesapproved or rejected; undecided returns one op to review (it is refused when deciding every undecided op).
expected_revisioninteger or nullnoThe changeset revision you were looking at. When it has moved the call is a 409, so a decision never lands on something you did not see.
provenanceobject or nullnoWho decided and why, for the revision journal. Omit to have it filled in from the key.
reasonstring or nullnoWhy, kept with the decision. Worth giving for a rejection.

Responses

StatusMeaning
200The request succeeded.
401The token is missing, expired or invalid.
403The token does not carry the scope this operation requires.
404No such project, or the token belongs to a different project.
422The request was not valid: a parameter or the body failed validation.

The 200 response body:

FieldTypeRequiredDescription
cascaded_op_idsarray of stringyesOps rejected because they depend on an op this call rejected.
changesetChangesetRecordyesThe open changeset as it stands after the decision.
decided_op_idsarray of stringyesThe ops whose decision this call changed.

Shapes

The named shapes used above.

ChangesetRecord

The open changeset: the proposed change and where review stands.

FieldTypeRequiredDescription
base_releaseintegeryesThe release the changeset was opened against. Send it back when staging.
base_repository_revisionstringyesA fingerprint of the repository state the changeset was opened against.
changeset_idstringyesThe changeset's id.
decision_summaryDecisionSummaryyesHow many ops have been decided.
invalidated_by_releaseinteger or nullnoThe release that made this changeset impossible to merge, if one did.
merge_claimed_atstring or nullnoWhen a publication claimed the changeset, while one is in progress.
next_seqintegeryesThe position the next staged op will take.
opened_atstringyesWhen the changeset was opened.
opened_byobjectyesWho opened it and why.
opsarray of ChangesetOpyesEvery op staged so far, in order.
project_idstringyesThe project the changeset belongs to.
published_releaseinteger or nullnoThe release it produced, once published.
revisionintegeryesThe changeset's revision. It changes every time the changeset does; send it back when staging.
settled_atstring or nullnoWhen it was published or abandoned.
settled_byobject or nullnoWho settled it.
statusstringyesWhether the changeset is open or how it was settled.
superseded_op_idsarray of stringyesOps that a later op overwrote.

DecisionSummary

How many ops review has decided.

FieldTypeRequiredDescription
approvedintegeryesOps approved.
rejectedintegeryesOps rejected.
undecidedintegeryesOps still waiting for a decision.

ChangesetOp

One staged op and what has been decided about it.

FieldTypeRequiredDescription
carried_fromstring or nullnoThe changeset the op was carried over from, if it was.
carried_tostring or nullnoThe changeset the op was carried over to, if it was.
cascaded_fromstring or nullnoThe op whose rejection caused this one to be rejected, if any.
conflictstring or nullnoWhy the op cannot merge as it stands, when something it depends on has moved; null otherwise.
decided_atstring or nullnoWhen it was decided.
decided_byobject or nullnoWho decided and why, once someone has; null while the op is undecided.
decisionstringyesWhere review stands: undecided, approved or rejected.
decision_historyarray of objectyesEvery decision made about the op, oldest first.
opobjectyesThe op as it was sent; its op field names the kind. GET changeset leaves out an upsert's content and the value of a patch's edit, which GET changeset/ops returns.
op_idstringyesThe id the service assigned when the op was staged. Use it to remove the op.
reasonstring or nullnoThe reason given for a rejection.
review_keystringyesGroups the ops a reviewer decides together.
seqintegeryesThe op's position in the changeset, in staging order.
staged_atstringyesWhen the op was staged.
staged_byobjectyesWho staged it and why.
statusstringyesThe op's state in the changeset.

Example

A request body (ids and values are placeholders), saved as body.json:

{
  "decision": "approved",
  "expected_revision": 3
}
curl -sS -X POST "$API_URL/context/v1/changeset/ops/$OP_ID/decision" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d @body.json