Vai al contenuto
Verificata

Elencare i ticket di assistenza

Porta la coda dello sportello nel tuo prodotto, filtrata, ordinata e paginata.

ticket_api_list è la stessa lettura filtrata, ordinata e paginata che usa il gestore dello sportello, limitata allo sportello della tua chiave API e senza mai includere i ticket di un altro tenant. Ogni campo è facoltativo; una richiesta vuota elenca tutto, a partire dall'attività più recente.

Metodo

POST/cpi/ticket_api_list
user

API: List Tickets

External service: lists tickets on the desk owned by the API key, with the same filters as the manager.

Procedura

Elenca, con filtri

Combina status, topic_id, reference_id e il testo libero search come serve alla tua schermata; sort è uno tra date_created_ts, last_activity_ts, status_ts o priority, dir è asc o desc.

curl -s https://xuda.ai/cpi/ticket_api_list \
  -H 'content-type: application/json' \
  -d '{
    "api_key": "YOUR_API_KEY",
    "status": "open",
    "sort": "last_activity_ts",
    "dir": "desc",
    "limit": 25
  }'
const res = await fetch('https://xuda.ai/cpi/ticket_api_list', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    status: 'open',
    sort: 'last_activity_ts',
    dir: 'desc',
    limit: 25,
  }),
});
const { code, data, bookmark } = await res.json();
if (code > 0) for (const t of data) console.log(t.ticket_no, t.status, t.subject);
import requests

res = requests.post(
    'https://xuda.ai/cpi/ticket_api_list',
    json={
        'api_key': 'YOUR_API_KEY',
        'status': 'open',
        'sort': 'last_activity_ts',
        'dir': 'desc',
        'limit': 25,
    },
)
body = res.json()
if body['code'] > 0:
    for t in body['data']:
        print(t['ticket_no'], t['status'], t['subject'])

2. Passa alla pagina successiva

Passa il bookmark della risposta precedente come bookmark per continuare oltre limit (fino a 500 per chiamata, il tetto dichiarato dal campo stesso).

curl -s https://xuda.ai/cpi/ticket_api_list \
  -H 'content-type: application/json' \
  -d '{"api_key":"YOUR_API_KEY","status":"open","limit":25,"bookmark":"g1AAAABweJzLYWBg..."}'
const res = await fetch('https://xuda.ai/cpi/ticket_api_list', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ api_key: 'YOUR_API_KEY', status: 'open', limit: 25, bookmark: previousBookmark }),
});
import requests

res = requests.post(
    'https://xuda.ai/cpi/ticket_api_list',
    json={'api_key': 'YOUR_API_KEY', 'status': 'open', 'limit': 25, 'bookmark': previous_bookmark},
)

La risposta

data è un array della stessa vista ridotta del ticket che restituisce aprire un ticket di assistenza (qui senza interactions, questa è la lista, non la lettura di dettaglio), e bookmark si trova accanto, al livello più alto e non dentro data:

json
{
  "code": 1,
  "data": [
    {
      "ticket_no": "TK-1042",
      "id": "tkt_3b7a10982341",
      "status": "open",
      "status_stage": "new",
      "subject": "Cannot export invoices",
      "requester": { "name": "Priya Shah", "email": "[email protected]", "phone": "", "company": "" },
      "priority": 2,
      "last_activity_ts": 1737042311422
    }
  ],
  "bookmark": "g1AAAABweJzLYWBg..."
}

Un array data vuoto è una risposta reale e riuscita per uno sportello senza nulla che corrisponda al filtro, non un errore.

Errori

Passi successivi