Skip to content

Getting Started with GraphQL

The motivation for using GraphQL is explained, and examples of common scenarios are provided to help get started with using the NodeZero® API. This will help develop an understanding of how to use the GraphQL API to interact with your data.

Authentication

Before getting started with the examples here, be sure to review the section on API Authentication.

Leverage the full power

Once you are comfortable interacting with the GraphQL API, head over to our API Reference for a complete list of queries and mutations available.

Why GraphQL?

The ITOps, SecOps, and automations engineering worlds are filled with REST APIs. So why did we choose a GraphQL API?

Data is power. We have a good idea how you might be able to use it, but it would be wrong of us to believe that we know better than you. GraphQL gives our developers far more control and flexibility through the ability to shape API queries to meet their needs. We wanted to provide the same power to our API users.

GraphQL.org

If you are new to GraphQL, we highly recommended reviewing the learning material at GraphQL.org.

HTTP Client

To send requests to the GraphQL API, an HTTP client is needed. This is mostly a personal choice and/or dependent on the systems you may be integrating with. For example, if you are trying to build your own HTML interface, you will likely need a client that runs in JavaScript to be compatible with internet browsers.

Here are a few examples of useful HTTP clients:

Need a specific programming language?

HTTP clients exist for every major programming language. A quick internet search should reveal the most well-known HTTP client(s) in any programming language.

Command Line Interface

Also be sure to check out the Horizon3.ai CLI for a ready-to-use API client.

Status codes

HTTP status codes returned by the /graphql endpoint are summarized below.

Code Title Description
200 Success Response contains the requested data.
400 Bad Request Malformed request, see errors field in the response data.
401 Unauthorized Not authenticated due to an invalid or expired JWT.
403 Forbidden Not authorized to access the requested resource.
5xx Internal Server Error An unexpected error was encountered.

Next Step

looks_one Authentication chevron_right
Learn how to authorize your session with graphql queries
looks_two GraphQL Examples chevron_right
Browse the exmples of the most common types of queries