GraphQL APIs

GraphQL is a query language that makes it easy to retrieve selected information from your TOS database in a structured format. If you are not familiar with GraphQL, we recommend the training and background information available at https://graphql.org/

GraphQL allows you to build queries for all the new features that were introduced with TOS Aurora. Older features in SecureTrack are still available using REST TOS APIs.

You can also implement database changes in GraphQL using 'mutations', for example, to modify zone mapping. For further information about mutations and examples, see Mutations.

See the documentation of GraphQL operations and types.

GraphiQL Interactive Console

TOS Aurora has an integrated GraphQL console - GraphiQL (pronounced graphical) - in which you can perform queries and mutations on the TOS database, and view the output on the screen. The GraphiQL console includes a documentation panel on the right which provides details of all available entities. In the left side of the screen, while typing a query you can press CTRL+SPACE to view a list of valid options.

You can build a search with up to 20 levels in the hierarchy.

You can access the live version of the GraphiQL console, which is linked to your data, with the following URL:
https://<TOS URL>/v2/api/sync/graphiql

You can also access the console through SecureTrack's interface, by selecting > GraphQL APIs.

The console for SNMP queries and mutations is located at https://<TOS URL>/v2/monitor-tower/graphiql and not at https://<TOS URL>/v2/api/sync/graphiql, which is used for most GraphQL queries.

Filtering GraphQL Queries

You can apply a filter to a GraphQL query to determine which data is retrieved. The list of available filters and the format is based on the filters available in TQL. For details, see Tufin Query Language.

You can build a search with up to 20 levels in the hierarchy.

To filter a GraphQL query, enter a TQL filter between double quotation marks ("). For example, the following query is filtered to retrieve rules that have a value in the name field and were last modified in the past 90 days:

{
  rules(filter: "name exists and timeLastModified after 90 days ago") {
    values{
      name
    }
  }
}

Limiting the Number of Items Retrieved

You can limit the number of items retrieved in a query using first and offset. In the following example, the query will receive two items (first 2), the first item retrieved will be the 3rd result (offset 3), counting from zero.

{
  rules {
    values(first: 2, offset: 3) {
      name
    }
  }
}

If no limit is defined, there is a default limit of 500 results in a query.

Counting the Number of Items Retrieved

You can use count to see the number of items that match a filter. The following example displays the number of rules with a permissiveness level of High.

{
  rules(filter: "permissivenessLevel='HIGH'") {
    count
  }
}