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

site

doc

blog

success stories

Consulting metadata with GraphQL API

Metadata are relevant information regarding the scope of data in the GraphQL API. They can help you understand the relationship and the utility of the request processes.

To check the GraphQL API’s metadata, 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. Running metadata requests 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. Save your Personal Token in a safe location to use it in the next section.

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

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

Running metadata requests with Postman

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

  1. On Postman’s upper header, 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 previously created:
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 Body tab > GraphQL option.
  4. On the QUERY box, add the following IntrospectionQuery:
query introspectionQuery {
 __type(name: "Query") {
   name
   description
   fields {
       name
       description
       type {
           ofType {
               fields {
                   name
                   type {
                       name
                      }
                  }
              }
          }
      }
  }
}
  1. On the Enter request URL field, add the GraphQL API URL being consulted: https://api.azionapi.net/metrics/graphql
  2. Click the Send button on the upper-right corner.

After running your request, you’ll see the following information as a response from the GraphQL API:

{
   "data": {
       "__type": {
           "name": "Query",
           "description":  "Class responsible for gathering the queries from the datasets and returning them in the form of graphql schema to the Django view.",
           "fields": [
               {
                   "name": "dataStreamedMetrics",
                   "description": "Query dataStreamed Aggregated with aggregate options.",
                   "type": {
                       "ofType": {
                           "fields": [
                               {
                                   "name": "ts",
                                   "type": {
                                       "name": "CustomDateTime"
                                   }
                               },
                               {
                                   "name": "endpointType",
                                   "type": {
                                       "name": "String"
                                   }
                               }
                           ]
                       }
                   }
               },
               {
                    "name": "httpMetrics",
                    "description": "Query Http Aggregated with aggregate options.",
                    "type": {
                        "ofType": {
                            "fields": [
                                {
                                    "name": "ts",
                                    "type": {
                                        "name": "CustomDateTime"
                                    }
                                },
                                {
                                    "name": "configurationId",
                                    "type": {
                                        "name": "String"
                                    }
                                }
                            ]
                       }
                   }
               }
           ]
       }
   }
}

The API returns the following metadata:

  • Datasets available to query, such as dataStreamedMetrics and httpMetrics.
  • Available fields for each dataset query.
  • Each type for returnable fields, such as Int, String, Datetime, and so on.

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


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