POST · Restaurer une version

Workflows : Restaurer une version. Paramètres, accès et exemples de réponse.

Rédigé par Red Blue

Mis à jour le

Workflows

POST /api/v1/workflows/restore

operationId : workflow_restore

Accès

Permission

Consentements OAuth

OAuth : délégation d’un équipier pour l’API

workflow.update

api:connect, workflow:write

KHONY_ORIGIN est l’origine HTTPS de votre application Khony, sans chemin final. Remplacez les identifiants de l’exemple par ceux de vos ressources autorisées. Les données de réponse ci-dessous illustrent le format ; elles ne sont pas le résultat d’un appel à votre organisation.

Paramètres et en-têtes

Nom

Emplacement

Requis

Type et contraintes

idempotency-key

header

Oui

string ; uuid

x-khony-confirmation

header

Non

string ; uuid

Champs du corps JSON

Nom

Emplacement

Requis

Type et contraintes

productId

JSON

Oui

string

workflowId

JSON

Oui

string

versionId

JSON

Oui

string

expectedRevision

JSON

Oui

integer ; Minimum : 0 ; Maximum : 9007199254740991

Exemple de requête

Shell
curl --request POST "$KHONY_ORIGIN/api/v1/workflows/restore" \
  --header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
  --header 'idempotency-key: 0198f886-9f71-7000-8000-000000000010' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "productId": "product_01k3w8d7vhe008000000000001",
  "workflowId": "workflow_01k3w8d7vhe008000000000001",
  "versionId": "workflow_version_01k3w8d7vhe008000000000001",
  "expectedRevision": 1
}'
Shell

Réponse de succès · HTTP 200

JSON
{
  "data": {
    "workflowId": "workflow_01k3w8d7vhe008000000000001",
    "draftId": "workflow_draft_01k3w8d7vhe008000000000001",
    "revision": 2,
    "restoredVersionId": "workflow_version_01k3w8d7vhe008000000000001"
  }
}
JSON
Schéma complet du corps JSON
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "productId": {
      "type": "string",
      "pattern": "^product_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "workflowId": {
      "type": "string",
      "pattern": "^workflow_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "versionId": {
      "type": "string",
      "pattern": "^workflow_version_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "expectedRevision": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "productId",
    "workflowId",
    "versionId",
    "expectedRevision"
  ],
  "additionalProperties": false
}
JSON
Schéma complet de la réponse
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "$ref": "#/$defs/__schema0"
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema0"
          }
        }
      ]
    }
  }
}
JSON

Refus et reprise

Les statuts documentés pour cette opération sont 400, 401, 402, 403, 404, 409, 428, 429, 500, 503. Identifiez la cause avec error.code et, lorsqu’il est présent, error.reason. Une réponse 409 peut demander une relecture de révision ou signaler une commande incompatible ; une réponse 428 demande une confirmation humaine. Ne rejouez une écriture que selon son contrat.

Notes du contrat
JSON
{
  "description": "Requires a dedicated API OAuth bearer for audience /api/v1, api:connect and the stated workflow scope, current organization/product consent and native human permissions. Organization keys and cookies are not accepted. Every admission consumes a product API request; native write billing checks apply. Send a stable UUID Idempotency-Key with exactly the same body on retry. Effects and the immutable receipt commit together. Changed payload or stale revision returns 409. Replays reauthorize the current human. For an Explorer version use the current Explorer draft revision; visual document and layout are restored together. For a canonical-only version use its canonical draft revision. Restoring does not republish or change existing runs."
}
JSON