1 of 20
2 of 20
3 of 20
4 of 20
5 of 20
6 of 20
7 of 20
8 of 20
9 of 20
10 of 20
11 of 20
12 of 20
13 of 20
14 of 20
15 of 20
16 of 20
17 of 20
18 of 20
19 of 20
20 of 20


Consulting Top X Queries with GraphQL API

Top X queries are mainly used to perform queries and analysis on data. They aim to help you visualize how resources and tools are being used and to provide a more detailed analysis on certain conditions that are either more or less used.

To query Top X queries through GraphQL API, you’ll need to go through two steps: creating a Personal Token and running your request on Postman. See the next sections and follow the presented steps.

  1. Creating Personal Tokens
  2. Consulting Top X data with Postman

Creating Personal Tokens

Before running your requests with the GraphQL API, you first need to create a Personal Token to validate your access.

  1. On Real-Time Manager (RTM), select Account Menu > Personal Tokens.
  2. Click Add Personal Token and fill in the fields.
  3. Save your Personal Token in a safe location to use it in the next section.

For more information on how to create one, see the Personal Tokens documentation page .

As an alternative, you can create a short-duration Personal Token through the Azion API.

Consulting Top X data with Postman

After creating your Personal Token, you must go to Postman and follow the next steps:

  1. On Postman’s upper header Postman, click the + button to create a new request.
  2. On the Headers tab, click on Bulk Edit and add the following code, along with the Personal Token value created previously:
Authorization:Token [TOKEN VALUE]

After creating the Headers with your token, remain on Postman to create the request’s body:

  1. On the upper-left corner, click the GET option to open a dropdown list.
  2. Select the POST option.
  3. On the options row, select the tab Body > GraphQL.
  4. On the QUERY box, add the following Top X Query:
query EventsTopUri {
   limit: 5,
   filter: {
     tsRange: {begin:"2022-11-20T10:10:10", end:"2022-11-27T10:10:10"}
   aggregate: {count: requestUri}
   groupBy: [requestUri]
   orderBy: [count_DESC]

The example queries the Events app for raw data with the HTTP dataset. In addition, the count operator requests data aggregation with information from the requestUri field during a set period of time, informed through the tsRange field. The API response was also limited to 5 registers by using the limit field.

Lastly, data were aggregated (groupBy) by the requestUri field and sorted (orderBy) by the return of the count operator in a descending (DESC) order. That way, the largest amount of aggregation responses is shown first.

To query aggregating data, it’s mandatory to inform:

  • A time range interval for queries using either tsRange or tsGt + tsLt.
  • The fields whose information you want to group using groupBy.
  • Which consulted data should be exhibited. On the presented example, the requestUri and count fields were used, in which count represents the response of the requestUri aggregation.

Now that you’ve queried your request, you can send it to the GraphQL API and receive a response with the data.

To send it to the API:

  1. On the Enter request URL field, add the GraphQL API URL being consulted: https://api.azionapi.net/events/graphql
  2. Click the Send button, located on the upper-right corner.

You’ll receive a response with the requested data, as in the following example:

   "data": {
       "httpEvents": [
               "requestUri": "/requests/images",
               "count": 610081
               "requestUri": "/path/to/file/document",
               "count": 6270
               "requestUri": "/send/stock",
               "count": 3568

The GraphQL API returned the Top RequestUri query data according to the query informed in the request.

For more information on aggregating data with the GraphQL API, visit the datasets documentation page.

Didn’t find what you were looking for? Open a support ticket.