POST · Configurer les définitions

Tickets : Configurer les définitions. Paramètres, accès et exemples de réponse.

Rédigé par Red Blue

Mis à jour le

Tickets

POST /api/v1/tickets/configuration

operationId : tickets_configure

Accès

Permission

Consentements OAuth

Clé API d’organisation

supportAutomation.write

Sans objet

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

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

"definition_create"

expectedCatalogRevision, definition

request.operation

"catalog_save"

catalog

request.operation

"defaults_save"

expectedRevision, settings

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/tickets/configuration" \
  --header "x-api-key: $KHONY_API_KEY" \
  --header 'idempotency-key: 0198f886-9f71-4000-8000-000000000010' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "productId": "product_01k3w8d7vhe008000000000001",
  "request": {
    "operation": "defaults_save",
    "expectedRevision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "settings": {
      "ticketDefaultPriority": "normal"
    }
  }
}'
Shell

Réponse de succès · HTTP 200

JSON
{
  "data": {
    "accepted": true
  }
}
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": {
            "operation": {
              "type": "string",
              "const": "definition_create"
            },
            "expectedCatalogRevision": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "definition": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "type"
                    },
                    "value": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "$ref": "#/$defs/__schema0"
                        },
                        "icon": {
                          "$ref": "#/$defs/__schema1"
                        },
                        "color": {
                          "$ref": "#/$defs/__schema2"
                        },
                        "category": {
                          "$ref": "#/$defs/__schema3"
                        },
                        "description": {
                          "$ref": "#/$defs/__schema4"
                        },
                        "titlePlaceholder": {
                          "$ref": "#/$defs/__schema5"
                        },
                        "descriptionPlaceholder": {
                          "$ref": "#/$defs/__schema6"
                        },
                        "visibility": {
                          "$ref": "#/$defs/__schema7"
                        },
                        "segmentIds": {
                          "$ref": "#/$defs/__schema8"
                        },
                        "agentEnabled": {
                          "$ref": "#/$defs/__schema10"
                        },
                        "customerEnabled": {
                          "$ref": "#/$defs/__schema11"
                        },
                        "archived": {
                          "$ref": "#/$defs/__schema12"
                        },
                        "fields": {
                          "$ref": "#/$defs/__schema13"
                        },
                        "statusIds": {
                          "$ref": "#/$defs/__schema15"
                        },
                        "initialStatusId": {
                          "$ref": "#/$defs/__schema17"
                        }
                      },
                      "required": [
                        "name",
                        "icon",
                        "category",
                        "description",
                        "titlePlaceholder",
                        "descriptionPlaceholder",
                        "visibility",
                        "segmentIds",
                        "agentEnabled",
                        "archived",
                        "fields",
                        "statusIds",
                        "initialStatusId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "kind",
                    "value"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "field"
                    },
                    "value": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "$ref": "#/$defs/__schema0"
                        },
                        "kind": {
                          "$ref": "#/$defs/__schema18"
                        },
                        "placeholder": {
                          "$ref": "#/$defs/__schema19"
                        },
                        "internal": {
                          "$ref": "#/$defs/__schema20"
                        },
                        "answerVisible": {
                          "$ref": "#/$defs/__schema21"
                        },
                        "options": {
                          "$ref": "#/$defs/__schema22"
                        },
                        "archived": {
                          "$ref": "#/$defs/__schema24"
                        }
                      },
                      "required": [
                        "label",
                        "kind",
                        "placeholder",
                        "internal",
                        "answerVisible",
                        "options",
                        "archived"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "kind",
                    "value"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "status"
                    },
                    "value": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "$ref": "#/$defs/__schema0"
                        },
                        "color": {
                          "$ref": "#/$defs/__schema25"
                        },
                        "behavior": {
                          "$ref": "#/$defs/__schema26"
                        },
                        "archived": {
                          "$ref": "#/$defs/__schema27"
                        }
                      },
                      "required": [
                        "label",
                        "color",
                        "behavior",
                        "archived"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "kind",
                    "value"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "operation",
            "expectedCatalogRevision",
            "definition"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "operation": {
              "type": "string",
              "const": "catalog_save"
            },
            "catalog": {
              "type": "object",
              "properties": {
                "version": {
                  "type": "number",
                  "const": 1
                },
                "revision": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "types": {
                  "maxItems": 100,
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/__schema28"
                  }
                },
                "fields": {
                  "maxItems": 200,
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/__schema29"
                  }
                },
                "statuses": {
                  "minItems": 1,
                  "maxItems": 100,
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/__schema30"
                  }
                }
              },
              "required": [
                "version",
                "revision",
                "types",
                "fields",
                "statuses"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "operation",
            "catalog"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "operation": {
              "type": "string",
              "const": "defaults_save"
            },
            "expectedRevision": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "settings": {
              "type": "object",
              "properties": {
                "ticketDefaultCategory": {
                  "$ref": "#/$defs/__schema31"
                },
                "ticketDefaultPriority": {
                  "$ref": "#/$defs/__schema32"
                },
                "ticketDefaultStatus": {
                  "$ref": "#/$defs/__schema33"
                },
                "ticketAssignToCreator": {
                  "$ref": "#/$defs/__schema34"
                }
              },
              "additionalProperties": false
            }
          },
          "required": [
            "operation",
            "expectedRevision",
            "settings"
          ],
          "additionalProperties": false
        }
      ]
    }
  },
  "required": [
    "productId",
    "request"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "__schema1": {
      "type": "string",
      "enum": [
        "ticket",
        "bug",
        "receipt",
        "question",
        "tools",
        "flag"
      ]
    },
    "__schema2": {
      "type": "string",
      "enum": [
        "neutral",
        "blue",
        "green",
        "orange",
        "purple",
        "red"
      ]
    },
    "__schema3": {
      "type": "string",
      "enum": [
        "customer",
        "backoffice",
        "tracker"
      ]
    },
    "__schema4": {
      "type": "string",
      "maxLength": 1000
    },
    "__schema5": {
      "type": "string",
      "maxLength": 240
    },
    "__schema6": {
      "type": "string",
      "maxLength": 1000
    },
    "__schema7": {
      "type": "string",
      "enum": [
        "team",
        "requester",
        "company"
      ]
    },
    "__schema8": {
      "maxItems": 30,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema9"
      }
    },
    "__schema9": {
      "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)$"
    },
    "__schema10": {
      "type": "boolean"
    },
    "__schema11": {
      "type": "boolean"
    },
    "__schema12": {
      "type": "boolean"
    },
    "__schema13": {
      "maxItems": 30,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema14"
      }
    },
    "__schema14": {
      "type": "object",
      "properties": {
        "fieldId": {
          "type": "string",
          "pattern": "^ticket_field_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
        },
        "required": {
          "type": "boolean"
        }
      },
      "required": [
        "fieldId",
        "required"
      ],
      "additionalProperties": false
    },
    "__schema15": {
      "minItems": 1,
      "maxItems": 30,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema16"
      }
    },
    "__schema16": {
      "type": "string",
      "pattern": "^ticket_status_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "__schema17": {
      "type": "string",
      "pattern": "^ticket_status_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "__schema18": {
      "type": "string",
      "enum": [
        "text",
        "long_text",
        "number",
        "select",
        "multi_select",
        "checkbox",
        "date",
        "file"
      ]
    },
    "__schema19": {
      "type": "string",
      "maxLength": 240
    },
    "__schema20": {
      "type": "boolean"
    },
    "__schema21": {
      "type": "boolean"
    },
    "__schema22": {
      "maxItems": 50,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema23"
      }
    },
    "__schema23": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema0"
        },
        "label": {
          "$ref": "#/$defs/__schema0"
        }
      },
      "required": [
        "id",
        "label"
      ]
    },
    "__schema24": {
      "type": "boolean"
    },
    "__schema25": {
      "type": "string",
      "enum": [
        "neutral",
        "blue",
        "green",
        "orange",
        "purple",
        "red"
      ]
    },
    "__schema26": {
      "type": "string",
      "enum": [
        "new",
        "open",
        "pending",
        "resolved"
      ]
    },
    "__schema27": {
      "type": "boolean"
    },
    "__schema28": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^ticket_type_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
        },
        "name": {
          "$ref": "#/$defs/__schema0"
        },
        "icon": {
          "$ref": "#/$defs/__schema1"
        },
        "color": {
          "$ref": "#/$defs/__schema2"
        },
        "category": {
          "$ref": "#/$defs/__schema3"
        },
        "description": {
          "$ref": "#/$defs/__schema4"
        },
        "titlePlaceholder": {
          "$ref": "#/$defs/__schema5"
        },
        "descriptionPlaceholder": {
          "$ref": "#/$defs/__schema6"
        },
        "visibility": {
          "$ref": "#/$defs/__schema7"
        },
        "segmentIds": {
          "$ref": "#/$defs/__schema8"
        },
        "agentEnabled": {
          "$ref": "#/$defs/__schema10"
        },
        "customerEnabled": {
          "$ref": "#/$defs/__schema11"
        },
        "archived": {
          "$ref": "#/$defs/__schema12"
        },
        "fields": {
          "$ref": "#/$defs/__schema13"
        },
        "statusIds": {
          "$ref": "#/$defs/__schema15"
        },
        "initialStatusId": {
          "$ref": "#/$defs/__schema17"
        }
      },
      "required": [
        "id",
        "name",
        "icon",
        "category",
        "description",
        "titlePlaceholder",
        "descriptionPlaceholder",
        "visibility",
        "segmentIds",
        "agentEnabled",
        "archived",
        "fields",
        "statusIds",
        "initialStatusId"
      ],
      "additionalProperties": false
    },
    "__schema29": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^ticket_field_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
        },
        "label": {
          "$ref": "#/$defs/__schema0"
        },
        "kind": {
          "$ref": "#/$defs/__schema18"
        },
        "placeholder": {
          "$ref": "#/$defs/__schema19"
        },
        "internal": {
          "$ref": "#/$defs/__schema20"
        },
        "answerVisible": {
          "$ref": "#/$defs/__schema21"
        },
        "options": {
          "$ref": "#/$defs/__schema22"
        },
        "archived": {
          "$ref": "#/$defs/__schema24"
        }
      },
      "required": [
        "id",
        "label",
        "kind",
        "placeholder",
        "internal",
        "answerVisible",
        "options",
        "archived"
      ],
      "additionalProperties": false
    },
    "__schema30": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^ticket_status_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
        },
        "label": {
          "$ref": "#/$defs/__schema0"
        },
        "color": {
          "$ref": "#/$defs/__schema25"
        },
        "behavior": {
          "$ref": "#/$defs/__schema26"
        },
        "archived": {
          "$ref": "#/$defs/__schema27"
        }
      },
      "required": [
        "id",
        "label",
        "color",
        "behavior",
        "archived"
      ],
      "additionalProperties": false
    },
    "__schema31": {
      "type": "string",
      "enum": [
        "customer",
        "backoffice",
        "tracker"
      ]
    },
    "__schema32": {
      "type": "string",
      "enum": [
        "low",
        "normal",
        "high",
        "urgent"
      ]
    },
    "__schema33": {
      "type": "string",
      "enum": [
        "new",
        "open"
      ]
    },
    "__schema34": {
      "type": "boolean"
    }
  }
}
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, 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": "Recommended configuration-only facade. Organization support-editor key required; native settings authority, revisions, tenant isolation and durable command receipt are unchanged. Use the exact Idempotency-Key on retry. Historical tickets_command remains compatible; operational commands are refused here."
}
JSON