POST · Consulter avec OAuth

Tickets : Consulter avec OAuth. Paramètres, accès et exemples de réponse.

Rédigé par Red Blue

Mis à jour le

Tickets

POST /api/v1/tickets/delegated/queries

operationId : tickets_delegated_query

Accès

Permission

Consentements OAuth

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

support.read

api:connect, support:read

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

contentCursor

JSON

Non

string ; Longueur maximale : 4096

Variantes de la requête

Sélecteur

Valeur

Autres champs requis dans request

request.view

"list"

Aucun autre champ imposé

request.view

"ticket"

ticketId

request.view

["updates","conversations","tracked","trackers"]

ticketId

request.view

"requesters"

search

request.view

"candidates"

conversationId, search

request.view

"catalog"

Aucun autre champ imposé

request.view

"defaults"

Aucun autre champ imposé

request.view

"forms"

conversationId

request.view

"conversation_state"

conversationId

request.view

"conversation_tickets"

conversationId

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/delegated/queries" \
  --header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "productId": "product_01k3w8d7vhe008000000000001",
  "request": {
    "view": "list",
    "status": "open",
    "search": "diagnostic",
    "limit": 20
  }
}'
Shell

Réponse de succès · HTTP 200

JSON
{
  "data": {
    "format": "application/json",
    "content": "{\"items\":[],\"total\":0,\"counts\":{\"all\":0,\"new\":0,\"open\":0,\"pending\":0,\"resolved\":0},\"canManage\":false,\"nextCursor\":null}",
    "offset": 0,
    "totalCharacters": 119,
    "nextCursor": null
  }
}
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": {
            "view": {
              "type": "string",
              "const": "list"
            },
            "status": {
              "type": "string",
              "enum": [
                "new",
                "open",
                "pending",
                "resolved"
              ]
            },
            "priority": {
              "type": "string",
              "enum": [
                "low",
                "normal",
                "high",
                "urgent"
              ]
            },
            "category": {
              "type": "string",
              "enum": [
                "customer",
                "backoffice",
                "tracker"
              ]
            },
            "search": {
              "type": "string",
              "maxLength": 160
            },
            "limit": {
              "$ref": "#/$defs/__schema0"
            },
            "cursor": {
              "$ref": "#/$defs/__schema1"
            }
          },
          "required": [
            "view"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "view": {
              "type": "string",
              "const": "ticket"
            },
            "ticketId": {
              "$ref": "#/$defs/__schema2"
            }
          },
          "required": [
            "view",
            "ticketId"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "view": {
              "type": "string",
              "enum": [
                "updates",
                "conversations",
                "tracked",
                "trackers"
              ]
            },
            "ticketId": {
              "$ref": "#/$defs/__schema2"
            },
            "limit": {
              "$ref": "#/$defs/__schema0"
            },
            "cursor": {
              "$ref": "#/$defs/__schema1"
            }
          },
          "required": [
            "view",
            "ticketId"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "view": {
              "type": "string",
              "const": "requesters"
            },
            "search": {
              "type": "string",
              "maxLength": 120
            }
          },
          "required": [
            "view",
            "search"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "view": {
              "type": "string",
              "const": "candidates"
            },
            "conversationId": {
              "$ref": "#/$defs/__schema3"
            },
            "search": {
              "type": "string",
              "maxLength": 160
            }
          },
          "required": [
            "view",
            "conversationId",
            "search"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "view": {
              "type": "string",
              "const": "catalog"
            }
          },
          "required": [
            "view"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "view": {
              "type": "string",
              "const": "defaults"
            }
          },
          "required": [
            "view"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "view": {
              "type": "string",
              "const": "forms"
            },
            "conversationId": {
              "$ref": "#/$defs/__schema3"
            },
            "ticketId": {
              "$ref": "#/$defs/__schema2"
            },
            "purpose": {
              "default": "form",
              "type": "string",
              "enum": [
                "options",
                "form"
              ]
            }
          },
          "required": [
            "view",
            "conversationId"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "view": {
              "type": "string",
              "const": "conversation_state"
            },
            "conversationId": {
              "$ref": "#/$defs/__schema3"
            }
          },
          "required": [
            "view",
            "conversationId"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "view": {
              "type": "string",
              "const": "conversation_tickets"
            },
            "conversationId": {
              "$ref": "#/$defs/__schema3"
            },
            "limit": {
              "$ref": "#/$defs/__schema0"
            },
            "cursor": {
              "$ref": "#/$defs/__schema1"
            }
          },
          "required": [
            "view",
            "conversationId"
          ],
          "additionalProperties": false
        }
      ]
    },
    "contentCursor": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4096
    }
  },
  "required": [
    "productId",
    "request"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "default": 20,
      "type": "integer",
      "minimum": 1,
      "maximum": 50
    },
    "__schema1": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4096
    },
    "__schema2": {
      "type": "string",
      "pattern": "^ticket_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "__schema3": {
      "type": "string",
      "pattern": "^support_conversation_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    }
  }
}
JSON
Schéma complet de la réponse
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "format": {
          "type": "string",
          "const": "application/json"
        },
        "content": {
          "type": "string"
        },
        "offset": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "totalCharacters": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "nextCursor": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "format",
        "content",
        "offset",
        "totalCharacters",
        "nextCursor"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false
}
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": "Dedicated API OAuth bearer with api:connect and support:read; cookies and MCP-audience tokens are refused. Preserves current teammate Inbox visibility and product/organization consent, with admin checks for configuration. Same native views as tickets_query. Content is paged as lossless JSON text fragments: concatenate content by offset until nextCursor=null, then JSON.parse. Repeat the exact request with contentCursor; native list pagination uses the separate request.cursor. Changed content invalidates continuation. Reauthorizes each page; no private snapshot retained."
}
JSON