How to query GraphQL requests on Postman

You can query GraphQL API requests on Postman or other API platforms. To use Postman, you need to go through two steps: create a personal token and run your request on Postman. See the next sections and follow the presented steps.


Before running your requests with the GraphQL API, you first need to create a personal token on Azion to validate your access.

  1. On Azion Console, on the upper-right corner, select Account menu > Personal Tokens.
  2. Fill the fields to configure the personal token and click the Create Token button.
  3. Copy and save your token in a safe location to use it in the next section.

See the Personal Tokens documentation for more information on how to create one.

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


After creating your personal token, go to Postman and follow the next steps:

  1. On the header, click the + button to create a new request.
  2. On the Headers tab, click on Bulk Edit and add the following code, replacing [TOKEN VALUE] with the personal token value you created:
Authorization: Token [TOKEN VALUE]

Remain on Postman and create the request’s body:

  1. Select the Body tab.
  2. On the upper-left corner, click the GET option to open a dropdown menu.
  3. Select the POST option.
  4. On the Enter URL or paste text field, add the URL being queried: https://api.azionapi.net/metrics/graphql or https://api.azionapi.net/events/graphql
  5. On the options row with radio buttons, select the GraphQL option.
  6. On the code box, add the query you want to use. For example:
query HttpQuery {
httpMetrics(
limit: 10,
filter: {
tsRange: {begin:"2022-03-21T10:10:10", end:"2022-06-23T10:10:10"}
}
aggregate: {sum: bytesSent}
groupBy: [ts]
orderBy: [ts_ASC]
)
{
ts
sum
}
}
  1. Click the Send button on the upper-right corner.

You’ll receive a response with the requested data, similar to this:

{
"data": {
"httpMetrics": [
{
"ts": "2022-06-09T21:33:13",
"sum": 1471.0
},
{
"ts": "2022-06-09T21:33:14",
"sum": 1471.0
},
{
"ts": "2022-06-09T21:33:15",
"sum": 1471.0
}
]
}
}

You can find queries examples on the GitHub azion-queries repository.


Contributors