POST · Modifier
Rédigé par Red Blue
Mis à jour le
POST /api/v1/knowledge/management/edit
operationId : knowledge_update
Accès | Permission | Consentements OAuth |
|---|---|---|
OAuth : délégation d’un équipier pour l’API | knowledge.update | api:connect, knowledge:update |
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 |
Variantes de la requête
Sélecteur | Valeur | Autres champs requis dans request |
|---|---|---|
request.operation | "collection" | collectionId, name, slug, description, position |
request.operation | "appearances" | updates |
request.operation | "article" | articleId, collectionId, title, slug, content, contentText, visibility, expectedRevision, expectedCollectionId |
request.operation | "move" | articleId, collectionId, expectedCollectionId |
request.operation | "order" | collectionId, articleIds, expectedArticleIds |
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
curl --request POST "$KHONY_ORIGIN/api/v1/knowledge/management/edit" \
--header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
--header 'Content-Type: application/json' \
--data-raw '{
"productId": "product_01k3w8d7vhe008000000000001",
"request": {
"operation": "article",
"collectionId": "help_collection_01k3w8d7vhe008000000000005",
"title": "Export a report",
"slug": "export-a-report",
"excerpt": "Export your data",
"content": {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Open the report and choose Export."
}
]
}
]
},
"contentText": "Open the report and choose Export.",
"visibility": "public",
"locale": "en",
"articleId": "help_article_01k3w8d7vhe008000000000004",
"expectedRevision": 1,
"expectedCollectionId": "help_collection_01k3w8d7vhe008000000000005"
}
}'Réponse de succès · HTTP 200
{
"status": "saved",
"id": "help_article_01k3w8d7vhe008000000000004"
}Schéma complet du corps 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": {
"operation": {
"$ref": "#/$defs/__schema0"
},
"collectionId": {
"$ref": "#/$defs/__schema1"
},
"name": {
"$ref": "#/$defs/__schema2"
},
"slug": {
"$ref": "#/$defs/__schema3"
},
"description": {
"$ref": "#/$defs/__schema4"
},
"position": {
"$ref": "#/$defs/__schema5"
},
"parentId": {
"$ref": "#/$defs/__schema6"
},
"rootArticleId": {
"$ref": "#/$defs/__schema7"
},
"isPublic": {
"$ref": "#/$defs/__schema9"
},
"icon": {
"$ref": "#/$defs/__schema10"
},
"color": {
"$ref": "#/$defs/__schema11"
},
"expectedParentId": {
"$ref": "#/$defs/__schema13"
},
"expectedRootArticleId": {
"$ref": "#/$defs/__schema14"
}
},
"required": [
"operation",
"collectionId",
"name",
"slug",
"description",
"position"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "appearances"
},
"updates": {
"minItems": 1,
"maxItems": 100,
"type": "array",
"items": {
"$ref": "#/$defs/__schema15"
}
}
},
"required": [
"operation",
"updates"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"$ref": "#/$defs/__schema16"
},
"articleId": {
"$ref": "#/$defs/__schema8"
},
"collectionId": {
"$ref": "#/$defs/__schema1"
},
"title": {
"$ref": "#/$defs/__schema17"
},
"slug": {
"$ref": "#/$defs/__schema18"
},
"excerpt": {
"$ref": "#/$defs/__schema19"
},
"content": {
"$ref": "#/$defs/__schema20"
},
"contentText": {
"$ref": "#/$defs/__schema22"
},
"visibility": {
"$ref": "#/$defs/__schema23"
},
"seoTitle": {
"$ref": "#/$defs/__schema24"
},
"seoDescription": {
"$ref": "#/$defs/__schema25"
},
"locale": {
"$ref": "#/$defs/__schema26"
},
"formatVersion": {
"$ref": "#/$defs/__schema27"
},
"titleDocument": {
"$ref": "#/$defs/__schema28"
},
"excerptDocument": {
"$ref": "#/$defs/__schema29"
},
"expectedRevision": {
"$ref": "#/$defs/__schema30"
},
"expectedCollectionId": {
"$ref": "#/$defs/__schema1"
},
"expectedTransform": {
"$ref": "#/$defs/__schema31"
}
},
"required": [
"operation",
"articleId",
"collectionId",
"title",
"slug",
"content",
"contentText",
"visibility",
"expectedRevision",
"expectedCollectionId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "move"
},
"articleId": {
"$ref": "#/$defs/__schema8"
},
"collectionId": {
"$ref": "#/$defs/__schema1"
},
"expectedCollectionId": {
"$ref": "#/$defs/__schema1"
}
},
"required": [
"operation",
"articleId",
"collectionId",
"expectedCollectionId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "order"
},
"collectionId": {
"$ref": "#/$defs/__schema1"
},
"articleIds": {
"maxItems": 1000,
"type": "array",
"items": {
"$ref": "#/$defs/__schema8"
}
},
"expectedArticleIds": {
"maxItems": 1000,
"type": "array",
"items": {
"$ref": "#/$defs/__schema8"
}
}
},
"required": [
"operation",
"collectionId",
"articleIds",
"expectedArticleIds"
],
"additionalProperties": false
}
]
}
},
"required": [
"productId",
"request"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"type": "string",
"const": "collection"
},
"__schema1": {
"type": "string",
"pattern": "^help_collection_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"__schema2": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"__schema3": {
"type": "string",
"minLength": 1,
"maxLength": 120,
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
},
"__schema4": {
"type": "string",
"maxLength": 500
},
"__schema5": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"__schema6": {
"anyOf": [
{
"$ref": "#/$defs/__schema1"
},
{
"type": "null"
}
]
},
"__schema7": {
"anyOf": [
{
"$ref": "#/$defs/__schema8"
},
{
"type": "null"
}
]
},
"__schema8": {
"type": "string",
"pattern": "^help_article_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"__schema9": {
"type": "boolean"
},
"__schema10": {
"type": "string",
"enum": [
"folder",
"book",
"document",
"graduation",
"code",
"cube",
"rocket",
"play",
"idea",
"support",
"tools",
"settings",
"globe",
"bolt",
"chart",
"sparkles",
"inbox",
"users",
"transfer",
"billing",
"ticket",
"channels",
"messenger",
"agent",
"copilot",
"shield",
"structure",
"writing",
"map",
"announcement",
"integrations",
"status",
"account",
"workspace"
]
},
"__schema11": {
"$ref": "#/$defs/__schema12"
},
"__schema12": {
"anyOf": [
{
"type": "string",
"enum": [
"gray",
"blue",
"violet",
"pink",
"amber",
"green",
"red"
]
},
{
"type": "string",
"pattern": "^#[0-9a-f]{6}$"
}
]
},
"__schema13": {
"anyOf": [
{
"$ref": "#/$defs/__schema1"
},
{
"type": "null"
}
]
},
"__schema14": {
"anyOf": [
{
"$ref": "#/$defs/__schema8"
},
{
"type": "null"
}
]
},
"__schema15": {
"type": "object",
"properties": {
"collectionId": {
"$ref": "#/$defs/__schema1"
},
"icon": {
"type": "string",
"enum": [
"folder",
"book",
"document",
"graduation",
"code",
"cube",
"rocket",
"play",
"idea",
"support",
"tools",
"settings",
"globe",
"bolt",
"chart",
"sparkles",
"inbox",
"users",
"transfer",
"billing",
"ticket",
"channels",
"messenger",
"agent",
"copilot",
"shield",
"structure",
"writing",
"map",
"announcement",
"integrations",
"status",
"account",
"workspace"
]
},
"color": {
"$ref": "#/$defs/__schema12"
},
"expectedIcon": {
"type": "string",
"maxLength": 80
},
"expectedColor": {
"type": "string",
"maxLength": 80
}
},
"required": [
"collectionId",
"icon",
"color",
"expectedIcon",
"expectedColor"
],
"additionalProperties": false
},
"__schema16": {
"type": "string",
"const": "article"
},
"__schema17": {
"type": "string",
"minLength": 3,
"maxLength": 180
},
"__schema18": {
"type": "string",
"minLength": 1,
"maxLength": 180,
"pattern": "^[\\p{L}\\p{N}]+(?:-[\\p{L}\\p{N}]+)*$"
},
"__schema19": {
"default": "",
"type": "string",
"maxLength": 500
},
"__schema20": {
"$ref": "#/$defs/__schema21"
},
"__schema21": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/__schema21"
}
},
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema21"
}
}
]
},
"__schema22": {
"type": "string",
"minLength": 1,
"maxLength": 100000
},
"__schema23": {
"type": "string",
"enum": [
"public",
"authenticated",
"internal"
]
},
"__schema24": {
"anyOf": [
{
"type": "string",
"maxLength": 180
},
{
"type": "null"
}
]
},
"__schema25": {
"anyOf": [
{
"type": "string",
"maxLength": 320
},
{
"type": "null"
}
]
},
"__schema26": {
"type": "string",
"maxLength": 35
},
"__schema27": {
"type": "number",
"const": 2
},
"__schema28": {
"$ref": "#/$defs/__schema20"
},
"__schema29": {
"$ref": "#/$defs/__schema20"
},
"__schema30": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"__schema31": {
"type": "object",
"properties": {
"sourceLocale": {
"type": "string",
"minLength": 2,
"maxLength": 35
},
"sourceVersion": {
"type": "string",
"enum": [
"draft",
"published"
]
},
"sourceRevision": {
"type": "integer",
"minimum": -1,
"maximum": 9007199254740991
},
"sourceIdentity": {
"anyOf": [
{
"type": "string",
"maxLength": 1500000
},
{
"type": "null"
}
]
},
"targetLocale": {
"type": "string",
"minLength": 2,
"maxLength": 35
},
"targetRevision": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"targetIdentity": {
"anyOf": [
{
"type": "string",
"maxLength": 1500000
},
{
"type": "null"
}
]
}
},
"required": [
"sourceLocale",
"sourceVersion",
"sourceRevision",
"sourceIdentity",
"targetLocale",
"targetRevision",
"targetIdentity"
],
"additionalProperties": false
}
}
}Schéma complet de la réponse
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"maxLength": 100
},
"ids": {
"maxItems": 1000,
"type": "array",
"items": {
"$ref": "#/$defs/__schema0"
}
},
"status": {
"type": "string",
"enum": [
"saved",
"deleted",
"pending",
"succeeded",
"failed",
"unknown"
]
},
"revision": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"status"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"type": "string",
"maxLength": 100
}
}
}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
{
"description": "Dedicated API OAuth bearer with api:connect and knowledge:update. A current real administrator session and consented product are required; API keys, MCP tokens and browser cookies are refused. Requires public API entitlement and one admitted product API request; mutations preserve billing write locks. Body limit 2 MiB; response limit 128 KiB. Edit collection metadata/hierarchy, appearances, article drafts, placement or complete collection order. Reuse native concurrency guards: expectedRevision and expectedCollectionId for article edits; expectedParentId/expectedRootArticleId when changing links; complete expectedArticleIds for order. Rich version 2 preserves title/excerpt documents. Editing a published article changes its draft; explicit publication is separate. No automatic retries."
}