This method allows you to execute an SPQL query on your database and returns the results. SPQL is used within the application to generate reports but can also be used to extract specific data if required.
/api/v2/tickets/spql
This method can be accessed by account tokens and user tokens where the associated user has access to the reporting UI.
spql
- the query you wish to execute (required)For further information about constructing SPQL queries please refer to this documentation.
If the query is executed successfully, you will receive a 200 OK
status with the results as shown below. If the query contains an error, you will receive a 422 Unprocessable Entity
result which will contain details about the error (see below).
{
"query": "SELECT COUNT, status.name FROM tickets GROUP BY status.name",
"fields": [
"COUNT",
"status.name"
],
"results": [
[
23,
"New"
],
[
3,
"Resolved"
],
[
2,
"Waiting for Customer"
],
[
5,
"Waiting for Staff"
]
]
}
{
"errors": [
"Invalid column 'tickets.asd' requested in SELECT"
]
}