# GraphQL API

## About iAdvize GraphQL API

iAdvize GraphQL API offers flexibility and the ability to define precisely the data you want to fetch.

One of the powers of GraphQL API is to allow you to retrieve many resources in one HTTP call and to request only the fields you need.

If you want to learn more about GraphQL in general, please check the official [GraphQL documentation](https://graphql.org/learn/).

It's useful to note that the official documentation also lists a [comprehensive list of clients and other tools here](https://graphql.org/code).

## API Root Endpoint

Our GraphQL API has a single endpoint: `https://api.iadvize.com/graphql`

The endpoint remains constant no matter what operation you perform.

If your environment is on the `SD` platform, your endpoint is: `https://api.iadvize.com/graphql?platform=sd`

The iAdvize GraphQL API is served over HTTPS.

## Building queries with GraphQL <a href="#forming-queries-with-graphql" id="forming-queries-with-graphql"></a>

Because GraphQL operations consist of potentially voluminous JSONs, we strongly recommend using our [Apollo integration to create your GraphQL calls](https://ha.iadvize.com/apollo). But, you can also use cURL or any other HTTP-speaking library.

While with REST we use HTTP verbs to define the operations to perform, in GraphQL we will use the HTTP POST verb. This is because you must provide a JSON-encoded body whether you are performing a query or a mutation.

**Here is an example to list all the routing rules :**

```bash

curl --request POST \
    --header 'content-type: application/json' \
    --header "Authorization: Bearer {YOUR_ACCESS_TOKEN}" \
    --url 'https://api.iadvize.com/graphql' \
    --data '{"query":"query {\n  routingRules {\n    id, name\n  }\n}","variables":{}}'
```

{% hint style="warning" %}
The string value of `"query"` must escape quotes and backslash characters or the schema will not parse it correctly.
{% endhint %}

## Apollo

You can discover the schema and run queries on your iAdvize data using Apollo, an integrated development environment in your browser that includes the schema description, syntax highlighting, and validation errors.

[Click here to use Apollo with our GraphQL api.](https://ha.iadvize.com/apollo)

If you want to know more about what can Apollo Explorer can do, you can checkout [their documentation here](https://www.apollographql.com/docs/graphos/explorer/).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.iadvize.dev/technologies/graphql-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
