Home / Basics / Highnote API

Using the Highnote API

Before You Start

As mentioned in Intro to GraphQL, an example ping query to the Highnote API looks like this:

curl -X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: <base64_encoded_api_key>' \
--data '{"query":"query Ping {\n  ping\n}"}' \
https://api.us.test.highnote.com/graphql

and will return a JSON payload with the following format:

{
  "data": {
    "ping": "pong"
  },
  "extensions": {
    "requestId": "REQUEST_ID"
  }
}

This guide breaks down this query and its response to provide guidance on using the Highnote API.

Headers

Lines 2 and 3 of our example ping query are headers. The Highnote API requires Authorization and Content-Type headers.

Content Type

The Highnote API accepts and returns JSON. To call the Highnote API, you must pass a Content-Type header with the value of application/json:

'Content-Type: application/json'

Authorization

Highnote API requests are authenticated using Basic auth. Using Basic auth, your API Key is provided as the username, and a password is not required. API Keys are created in the Dashboard. To obtain an API Key, see Creating and Managing API Keys.

Once you have obtained an API Key, to make a request, pass an Authorization header with your base64 encoded API key:

'Authorization': 'Basic <base64_encoded_api_key>'

Requests with missing or invalid credentials will receive a 401 Unauthorized response code.

Alternatively, you can use a client like Postman for authorization using the following steps:

  1. In Postman, create a new request.
  2. Select the Authorization section.
  3. Select Basic and pass your API key.

Request Body

In our ping query example, the request body is displayed on line 4. The Highnote GraphQL API accepts POST requests with JSON payloads. The requests must contain a string named query, but can also contain variables and operationName.

Query

The query is the GraphQL operation that you are calling:

{
  "query": "{ ping }"
}

You can make multiple GraphQL requests in a single call. In this case, you would still provide a single query value with all calls as a string.

Request URLs

Our example ping query has a Request URL on line 5. Request URLs used for the Highnote API differ depending on your environment. The endpoint of the URLs will both be /graphql, but the sub-domain will differ:

Test Environment Request URL
https://api.us.test.highnote.com/graphql
Live Environment Request URL
https://api.us.highnote.com/graphql

Status Codes

In GraphQL, unlike REST APIs, you'll often receive a 200 OK status code even for error situations. For error handling, the response includes an 'errors' object with detailed information for troubleshooting. For mutations, request 'userErrors' in your query for specific debug details. See error handling for more information.

The following HTTP status codes will be returned from the API:

Status CodeScenario
200 OKGraphQL request was successful or validation/logic errors occurred. See error handling for more information.
400 Bad RequestGraphQL validation failed. This is generally because of malformed input or selection sets. In this case, the errors collection will be present on the response body.
401 UnauthorizedReturned when invalid credentials are present.
5xxSomething is wrong on the Highnote side.

Response Bodies

Read more about GraphQL responses and formats in the spec.

The Response Body contains the data requested from the API endpoint. Read more about GraphQL responses and formats in the spec.

The Highnote API returns JSON response bodies. The responses will contain the following:

Response BodyDescription
dataThe result of the given operation(s). This data will reflect the shape of your selection on the query.
errorsThe errors collection will be present if the GraphQL engine failed to parse or validate the given request. Read more about errors in the spec.
extensionsThe extensions field is a map of data custom to a GraphQL implementation. For the Highnote API, the extensions field will contain a requestId for use in debugging or support scenarios.

If you need help with a response, see troubleshooting with Request IDs in the Highnote API.

Provide Feedback

Was this content helpful?