Filter for Open and Assigned Tickets
This article provides an example demonstrating how to execute a GraphQL query via the Brinqa API to retrieve specific tickets based on your selected criteria. While this example focuses on a specific set of attributes, you can tailor the query to include the attributes that fit your needs. For more details on the GraphiQL explorer, see how to use the GraphiQL explorer.
To query for open and assigned tickets in the GraphiQL Explorer, follow these steps:
-
Log in to your Brinqa Platform as a System Administrator.
-
Navigate to Administration > System > GraphQL Explorer.
-
Click Show GraphiQL Explorer to display or switch to the GraphiQL Explorer.
-
Click tickets to display the options and fields for tickets.
-
To specify a filter, select the filter option and provide a condition such as
status=open
. -
To specify the number of records to be returned, select the limit option and type a number. The default number is 10.
-
To include specific fields in your query, select them from the available fields. For example, you can select assigned > fullName, buid, complianceStatus, dueDate, name, riskRating, and uid. If needed, click the field again to remove it from the query.
For a brief description of each field, refer to the Docs menu within the GraphQL Explorer. You can use the search function to find specific attributes, or browse the list to get a brief description of each field.
- After you've selected all the desired fields, click Execute query or press Ctrl-Enter to run the query.
The right pane displays the results. You can modify the query by changing the filter conditions and the limit, or by selecting different fields to include in the response.
After you've verified that the query is fetching the desired data, you can either copy the query itself or click Show GraphiQL Code Exporter to obtain the cURL command.
Here's the cURL command corresponding to the query in the screenshot. It sends a POST
request to the Brinqa GraphQL endpoint with specific headers, such as Content-Type
and Authorization
, to ensure proper handling of the JSON content and authentication:
curl 'https://<BrinqaPlatformName>.brinqa.net/graphql/caasm' \
--compressed \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-access-token>" \
-H "Accept: application/json" \
-H "Accept-Encoding: gzip, deflate" \
--data '{
"query": "query MyQuery { tickets(filter: "status=open") { assigned { fullName } buid complianceStatus dueDate name riskRating uid }}",
"variables": null,
"operationName": "MyQuery"
}'
Replace <BrinqaPlatformName>
with the actual name of your Brinqa Platform and replace <your-access-token>
with your access token.
The result of this query is a JSON object containing an array of open tickets. Each ticket item consists of the fields you have selected in your query. The provided result is a snapshot of the tickets that meet the criteria specified in the query:
{
"data": {
"tickets": [
{
"assigned": { "fullName": "John Doe" },
"buid": "BRINQA-1686488211321389058",
"complianceStatus": "Within SLA",
"dueDate": "2023-08-31T21:25:04.284Z",
"name": "Cisco IOS Software DHCPv6 Relay Denial of Service Vulnerability ( cisco-sa-20160323-dhcpv6)",
"riskRating": "High",
"uid": "e843191c-ced7-4f84-9a64-695de360917a"
}
// ... other tickets here ...
]
}
}