Skip to main content

Cato Networks Knowledge Base

Connecting to the Cato API Server from the GraphQL Playground

  • Updated

This article explains how to use the GraphQL Playground to run some sample queries and test connectivity to the Cato Networks API server.

Overview of GraphQL Playground

The GraphQL Playground lets you run API queries that are sent directly to the Cato API server. Third-party API query software such as Altair or Postman, provide powerful functionality for running API calls. However, if there is a connectivity issue with API queries, you can use the Playground to help identify the cause of the issue.

Prerequisites for Cato API Queries with the GraphQL Playground

To run a Cato API query from the GraphQL Playground, you must have the API key for your account (Administration > API Access Management). For more about the API keys, see Generating API Keys for the Cato API.

The sample queries also require that you enter the Cato Management Application ID for your account. This account ID isn't shown in the Cato Management Application, instead it is the number in the URL for the Cato Management Application. For example, the account ID is 26 for the following URL: https://cc2.catonetworks.com/#!/26/topology.

Testing Connectivity with Sample Cato API Queries

You can run a sample API query to test connectivity to the Cato API server. When the account id argument and API key are configured correctly, then the sample API query returns the account data and shows the results in the GraphQL Playground.

If the query doesn't return results for your account, then there may be a connectivity issue to the API server or the server may be down.

The following sample API queries can help you test connectivity to the Cato API server:

For more about troubleshooting issues with the Cato API, see Troubleshooting Cato API Calls.

Running a Sample API Query in GraphQL Playground

Use an Internet browser to open the GraphQL Playground for the Cato API. Configure the HTTP header for the Playground with your API key. Paste the sample query in the left-hand pane and enter your account ID. Then you can run the query and see the results in the Playground.

To run a sample API query:

  1. Download one of the sample API queries from this article and open the file in a text editor such as Notepad.
  2. From an Internet browser, go to the GraphQL Playground for the Cato API: https://api.catonetworks.com/api/v1/graphql2.
  3. In the bottom of the left-hand pane, click HTTP HEADERS.
  4. Enter your API key in this format: { "x-api-key" :"<api key>" }.

    The following screenshot shows the HTTP header configured with the API key aaBbCcdD1122334455eefFGGhh667788:

  5. Copy and paste one of the sample queries into the left-hand pane of the Playground.
  6. At the top of the query, in the id argument enter your account ID.

    The following screenshot shows the id argument configured with the value 2626:

  7. Click the play button.

    The right hand pane shows the results of the API query. The following screenshot shows the results for the sample accountMetrics query for account ID 2626:

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.