Tickets API
POST /tickets
Description
This API endpoint retrieves a list of tickets based on pagination and optional filters such as category and status.
Request Body
The request uses GraphQL to perform the tickets
query, which supports pagination and optional filters.
Query:
query tickets ($page: Int, $size: Int, $category: TicketCategory, $status: TicketStatus) {
tickets (page: $page, size: $size, category: $category, status: $status) {
totalElements
size
number
}
}
GraphQL Variables:
{
"page": 0,
"size": 0,
"category": "",
"status": ""
}
Example Request:
curl --location '' \
--header 'Content-Type: application/json' \
--data '{"query":"query tickets ($page: Int, $size: Int, $category: TicketCategory, $status: TicketStatus) {\n tickets (page: $page, size: $size, category: $category, status: $status) {\n totalElements\n size\n number\n }\n}","variables":{"page":0,"size":0,"category":"","status":""}}'
Response:
-
Success (200 OK):
- The response includes the total number of tickets, the number of tickets on the current page, and the page number.
{
"data": {
"tickets": {
"totalElements": 100,
"size": 20,
"number": 1
}
}
}totalElements
: Total number of tickets that match the query criteria.size
: Number of tickets on the current page.number
: Current page number.
-
Error (4XX/5XX):
- If there is an issue with the request (e.g., invalid parameters) or if there is a server error, the response will include an error message and status code.
Note:
To use this endpoint, specify the page
and size
for pagination. You can also filter by category
and status
to narrow down the results. The response provides the total count of tickets, the number of tickets returned for the current page, and the page number.