Skip to content

API: Images

Go back to an earlier revision of an image as a new step

POST /api/v1/images/{id}/revert: Go back to an earlier revision of an image as a new step

Last updated:

POST/api/v1/images/{id}/revert

Authentication#

Send the secret in the header Authorization: Bearer <secret>: the local token in local mode, an API key in network mode. An API key needs the edit scope; the local token has every scope. See the API overview for both modes.

Path parameters#

NameTypeRequiredDescription
idstringyesmin length 1

Request body#

Content type application/json.

NameTypeRequiredDescription
base_revisioninteger (int64)noThe revision the caller read; default the current one.
checkpointstringnoThe name of a checkpoint to go back to; or revision.
dry_runbooleanno
revisioninteger (int64)noThe revision to go back to; or checkpoint.

Responses#

200 OK#

Content type application/json. Schema: ImageRevertResult.

NameTypeRequiredDescription
actorstringno
appliedbooleanno
base_revisioninteger (int64)no
createdarray of stringno
descriptionstringno
diffarray of Changeno
dry_runbooleanno
effectivearray of OpEffectno
findingsarray of Findingno
image_idstringno
kindstringno
lintLintTotalsno
replayedbooleanno
revisioninteger (int64)no
samebooleanno
targetinteger (int64)no
textstringno
untrusted_noticestringno

400#

Validation failed; errors maps each field to its messages and issues lists each problem with its code, key and params

Content type application/problem+json. Schema: Problem.

401 Unauthorized#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

403#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

404#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

409#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

422 Unprocessable Content#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

429#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

Any other status#

Error (RFC 9457 problem details)

Content type application/problem+json. Schema: Problem.

curl -X POST "http://127.0.0.1:7878/api/v1/images/PROJECT_ID/revert" \
  -H "Authorization: Bearer $STUARTY_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Response examples

{
  "actor": "string",
  "applied": false,
  "base_revision": 0,
  "created": [
    "string"
  ],
  "description": "string",
  "diff": [
    {
      "changes": {},
      "id": "string",
      "kind": "string",
      "object": {}
    }
  ],
  "dry_run": false,
  "effective": [
    {
      "created": [],
      "effective": {},
      "index": 0,
      "op": "string"
    }
  ],
  "findings": [
    {
      "code": "string",
      "hint": "string",
      "item": "string",
      "message": "string",
      "range": {},
      "severity": "string"
    }
  ],
  "image_id": "string",
  "kind": "string",
  "lint": {
    "errors": 0,
    "lint_scope": "string",
    "warnings": 0
  },
  "replayed": false,
  "revision": 0,
  "same": false,
  "target": 0,
  "text": "string",
  "untrusted_notice": "string"
}

The examples are built from the schemas of the OpenAPI document, so a value is a placeholder of its type. The fields that carry the real values are in the tables.