POST · Préparer une mise à jour

Statut : Préparer une mise à jour. Paramètres, accès et exemples de réponse.

Rédigé par Red Blue

Mis à jour le

Statut

POST /api/v1/status/commands

operationId : status_command

Accès

Permission

Consentements OAuth

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

status.write

api:connect, status: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.

Champs du corps JSON

Nom

Emplacement

Requis

Type et contraintes

productId

JSON

Oui

string

request

JSON

Oui

object

idempotencyKey

JSON

Oui

string ; uuid

Variantes de la requête

Sélecteur

Valeur

Autres champs requis dans request

request.type

"component_create"

name

request.type

"component_edit"

componentId, expectedRevision, patch

request.type

"incident_edit"

incidentId, expectedRevision, patch

request.type

"template_create"

name, title, body, impact, componentIds

request.type

"template_edit"

templateId, expectedRevision, name, title, body, impact, componentIds

request.type

"settings"

expectedRevision, audience, segmentIds, description, emailsEnabled

Choisissez une variante et respectez son schéma complet : les contraintes des champs optionnels et les unions imbriquées restent applicables.

Exemple de requête

Shell
curl --request POST "$KHONY_ORIGIN/api/v1/status/commands" \
  --header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
  --header 'X-Khony-Confirmation: 0198f886-9f71-7000-8000-000000000011' \
  --header 'Idempotency-Key: 0198f886-9f71-7000-8000-000000000010' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "productId": "product_01k3w8d7vhe008000000000001",
  "idempotencyKey": "0198f886-9f71-7000-8000-000000000010",
  "request": {
    "type": "component_create",
    "name": "API"
  }
}'
Shell

Réponse de succès · HTTP 200

JSON
{
  "kind": "changed",
  "resource": "component",
  "id": "status_component_01k3w8d7vhe008000000000001",
  "revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "readRequest": {
    "view": "component",
    "componentId": "status_component_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}$"
    },
    "request": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "component_create"
            },
            "name": {
              "$ref": "#/$defs/__schema0"
            },
            "description": {
              "type": "string",
              "maxLength": 500
            },
            "groupName": {
              "type": "string",
              "maxLength": 120
            }
          },
          "required": [
            "type",
            "name"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "component_edit"
            },
            "componentId": {
              "type": "string",
              "pattern": "^status_component_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            },
            "expectedRevision": {
              "$ref": "#/$defs/__schema1"
            },
            "patch": {
              "type": "object",
              "properties": {
                "name": {
                  "$ref": "#/$defs/__schema2"
                },
                "description": {
                  "$ref": "#/$defs/__schema3"
                },
                "groupName": {
                  "$ref": "#/$defs/__schema4"
                },
                "position": {
                  "$ref": "#/$defs/__schema5"
                },
                "state": {
                  "$ref": "#/$defs/__schema6"
                },
                "showUptime": {
                  "$ref": "#/$defs/__schema7"
                },
                "segmentIds": {
                  "$ref": "#/$defs/__schema8"
                }
              },
              "additionalProperties": false
            }
          },
          "required": [
            "type",
            "componentId",
            "expectedRevision",
            "patch"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "incident_edit"
            },
            "incidentId": {
              "type": "string",
              "pattern": "^status_incident_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            },
            "expectedRevision": {
              "$ref": "#/$defs/__schema1"
            },
            "patch": {
              "type": "object",
              "properties": {
                "title": {
                  "$ref": "#/$defs/__schema11"
                },
                "description": {
                  "$ref": "#/$defs/__schema13"
                },
                "descriptionContent": {
                  "$ref": "#/$defs/__schema15"
                },
                "impact": {
                  "$ref": "#/$defs/__schema17"
                },
                "componentIds": {
                  "$ref": "#/$defs/__schema19"
                },
                "scheduledStartAt": {
                  "$ref": "#/$defs/__schema22"
                },
                "scheduledEndAt": {
                  "$ref": "#/$defs/__schema24"
                },
                "autoStart": {
                  "$ref": "#/$defs/__schema25"
                },
                "autoComplete": {
                  "$ref": "#/$defs/__schema26"
                },
                "notifySubscribers": {
                  "$ref": "#/$defs/__schema27"
                }
              },
              "additionalProperties": false
            }
          },
          "required": [
            "type",
            "incidentId",
            "expectedRevision",
            "patch"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "template_create"
            },
            "name": {
              "$ref": "#/$defs/__schema0"
            },
            "title": {
              "$ref": "#/$defs/__schema12"
            },
            "body": {
              "$ref": "#/$defs/__schema14"
            },
            "bodyContent": {
              "$ref": "#/$defs/__schema15"
            },
            "impact": {
              "$ref": "#/$defs/__schema18"
            },
            "componentIds": {
              "$ref": "#/$defs/__schema21"
            }
          },
          "required": [
            "type",
            "name",
            "title",
            "body",
            "impact",
            "componentIds"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "template_edit"
            },
            "templateId": {
              "type": "string",
              "pattern": "^status_template_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            },
            "expectedRevision": {
              "$ref": "#/$defs/__schema1"
            },
            "name": {
              "$ref": "#/$defs/__schema0"
            },
            "title": {
              "$ref": "#/$defs/__schema12"
            },
            "body": {
              "$ref": "#/$defs/__schema14"
            },
            "bodyContent": {
              "$ref": "#/$defs/__schema15"
            },
            "impact": {
              "$ref": "#/$defs/__schema18"
            },
            "componentIds": {
              "$ref": "#/$defs/__schema21"
            }
          },
          "required": [
            "type",
            "templateId",
            "expectedRevision",
            "name",
            "title",
            "body",
            "impact",
            "componentIds"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "settings"
            },
            "expectedRevision": {
              "$ref": "#/$defs/__schema1"
            },
            "audience": {
              "type": "string",
              "enum": [
                "public",
                "authenticated",
                "segments"
              ]
            },
            "segmentIds": {
              "$ref": "#/$defs/__schema9"
            },
            "description": {
              "type": "string",
              "maxLength": 500
            },
            "emailsEnabled": {
              "type": "boolean"
            }
          },
          "required": [
            "type",
            "expectedRevision",
            "audience",
            "segmentIds",
            "description",
            "emailsEnabled"
          ],
          "additionalProperties": false
        }
      ]
    },
    "idempotencyKey": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    }
  },
  "required": [
    "productId",
    "request",
    "idempotencyKey"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "type": "string",
      "minLength": 2,
      "maxLength": 120
    },
    "__schema1": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "__schema2": {
      "$ref": "#/$defs/__schema0"
    },
    "__schema3": {
      "type": "string",
      "maxLength": 500
    },
    "__schema4": {
      "type": "string",
      "maxLength": 120
    },
    "__schema5": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10000
    },
    "__schema6": {
      "type": "string",
      "enum": [
        "operational",
        "maintenance",
        "degraded",
        "partial_outage",
        "major_outage"
      ]
    },
    "__schema7": {
      "type": "boolean"
    },
    "__schema8": {
      "$ref": "#/$defs/__schema9"
    },
    "__schema9": {
      "maxItems": 50,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema10"
      }
    },
    "__schema10": {
      "type": "string",
      "pattern": "^segment_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "__schema11": {
      "$ref": "#/$defs/__schema12"
    },
    "__schema12": {
      "type": "string",
      "minLength": 2,
      "maxLength": 240
    },
    "__schema13": {
      "$ref": "#/$defs/__schema14"
    },
    "__schema14": {
      "type": "string",
      "minLength": 2,
      "maxLength": 20000
    },
    "__schema15": {
      "anyOf": [
        {
          "$ref": "#/$defs/__schema16"
        },
        {
          "type": "null"
        }
      ]
    },
    "__schema16": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema16"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema16"
          }
        }
      ]
    },
    "__schema17": {
      "$ref": "#/$defs/__schema18"
    },
    "__schema18": {
      "type": "string",
      "enum": [
        "minor",
        "major",
        "critical"
      ]
    },
    "__schema19": {
      "minItems": 1,
      "$ref": "#/$defs/__schema21"
    },
    "__schema20": {
      "type": "string",
      "pattern": "^status_component_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "__schema21": {
      "maxItems": 50,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema20"
      }
    },
    "__schema22": {
      "$ref": "#/$defs/__schema23"
    },
    "__schema23": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "__schema24": {
      "$ref": "#/$defs/__schema23"
    },
    "__schema25": {
      "type": "boolean"
    },
    "__schema26": {
      "type": "boolean"
    },
    "__schema27": {
      "type": "boolean"
    }
  }
}
JSON
Schéma complet de la réponse
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "changed"
        },
        "resource": {
          "type": "string",
          "enum": [
            "component",
            "incident",
            "template",
            "settings"
          ]
        },
        "id": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^status_component_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            },
            {
              "type": "string",
              "pattern": "^status_incident_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            },
            {
              "type": "string",
              "pattern": "^status_template_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            }
          ]
        },
        "revision": {
          "$ref": "#/$defs/__schema0"
        },
        "readRequest": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "view": {
                  "type": "string",
                  "const": "component"
                },
                "componentId": {
                  "type": "string",
                  "pattern": "^status_component_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
                },
                "contentCursor": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "view",
                "componentId"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "view": {
                  "type": "string",
                  "const": "components"
                },
                "contentCursor": {
                  "$ref": "#/$defs/__schema2"
                },
                "after": {
                  "$ref": "#/$defs/__schema3"
                },
                "limit": {
                  "$ref": "#/$defs/__schema4"
                }
              },
              "required": [
                "view",
                "limit"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "view": {
                  "type": "string",
                  "const": "incidents"
                },
                "contentCursor": {
                  "$ref": "#/$defs/__schema2"
                },
                "after": {
                  "$ref": "#/$defs/__schema3"
                },
                "limit": {
                  "$ref": "#/$defs/__schema4"
                },
                "search": {
                  "type": "string",
                  "maxLength": 160
                }
              },
              "required": [
                "view",
                "limit"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "view": {
                  "type": "string",
                  "const": "incident"
                },
                "incidentId": {
                  "type": "string",
                  "pattern": "^status_incident_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
                },
                "contentCursor": {
                  "$ref": "#/$defs/__schema2"
                },
                "after": {
                  "$ref": "#/$defs/__schema3"
                },
                "limit": {
                  "$ref": "#/$defs/__schema4"
                }
              },
              "required": [
                "view",
                "incidentId",
                "limit"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "view": {
                  "type": "string",
                  "const": "templates"
                },
                "contentCursor": {
                  "$ref": "#/$defs/__schema2"
                },
                "after": {
                  "$ref": "#/$defs/__schema3"
                },
                "limit": {
                  "$ref": "#/$defs/__schema4"
                }
              },
              "required": [
                "view",
                "limit"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "view": {
                  "type": "string",
                  "const": "template"
                },
                "templateId": {
                  "type": "string",
                  "pattern": "^status_template_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
                },
                "contentCursor": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "view",
                "templateId"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "view": {
                  "type": "string",
                  "const": "settings"
                },
                "contentCursor": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "view"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "view": {
                  "type": "string",
                  "const": "management"
                },
                "contentCursor": {
                  "$ref": "#/$defs/__schema2"
                },
                "after": {
                  "$ref": "#/$defs/__schema3"
                },
                "limit": {
                  "$ref": "#/$defs/__schema4"
                }
              },
              "required": [
                "view",
                "limit"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "view": {
                  "type": "string",
                  "const": "uptime"
                },
                "componentIds": {
                  "minItems": 1,
                  "maxItems": 50,
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/__schema5"
                  }
                },
                "contentCursor": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "view",
                "componentIds"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": [
        "kind",
        "resource",
        "revision",
        "readRequest"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "deleted"
        },
        "resource": {
          "type": "string",
          "enum": [
            "component",
            "incident",
            "template"
          ]
        },
        "id": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^status_component_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            },
            {
              "type": "string",
              "pattern": "^status_incident_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            },
            {
              "type": "string",
              "pattern": "^status_template_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            }
          ]
        }
      },
      "required": [
        "kind",
        "resource",
        "id"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "imported"
        },
        "requested": {
          "type": "number"
        },
        "skipped": {
          "type": "number"
        }
      },
      "required": [
        "kind",
        "requested",
        "skipped"
      ],
      "additionalProperties": false
    }
  ],
  "$defs": {
    "__schema0": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "__schema1": {
      "type": "object",
      "properties": {
        "hash": {
          "$ref": "#/$defs/__schema0"
        },
        "offset": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "asOf": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        }
      },
      "required": [
        "hash",
        "offset",
        "asOf"
      ],
      "additionalProperties": false
    },
    "__schema2": {
      "$ref": "#/$defs/__schema1"
    },
    "__schema3": {
      "type": "string",
      "maxLength": 240
    },
    "__schema4": {
      "default": 20,
      "type": "integer",
      "minimum": 1,
      "maximum": 50
    },
    "__schema5": {
      "type": "string",
      "pattern": "^status_component_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    }
  }
}
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": "Current native administrator OAuth status:write and verified runtime human confirmation (HTTP 428 handshake). Create/edit services or ARTICLE templates, edit incident details, update audience/email settings. Expected opaque revisions guard existing targets under the native per-product lock. Stable UUID idempotencyKey plus identical input returns the durable receipt; altered input conflicts. Current native access and billing are checked again before replay, including deleted targets. Native outbox and effective-state reconciliation apply. Metadata edits do not notify subscribers. Response contains only a bounded changed locator with revision/readRequest, deletion locator or import counts. Pass changed.readRequest to status_read for the complete native record; ARTICLE is not copied into receipts. ARTICLE input uses the native HTTP ceiling of 128 MiB; infrastructure and memory limits still apply. Native ARTICLE validation and normalization are unchanged."
}
JSON