# GraphQL APIs

## Feature Introduction

This feature shows the typical GraphQL autocomplete, which is derived from the API's schema, in GraphQL code fields.

<div align="center"><figure><img src="/files/TIUxJGTRmiW7w7Gyu1Y1" alt="" width="563"><figcaption><p>GraphQL autocomplete</p></figcaption></figure></div>

## Configuration on connector

On the connector the field **External schema config** has to be filled with a JSON that describes where the schema can be found.

The necessary details for the configuration can usually be found in the Connector's API documentation or, if the API offers this, on their GraphQL 'playground'.

```json
{
    "endpoint": "graphql",
    "body": {
      "operationName": "IntrospectionQuery",
      "variables": {},
      "query": "query IntrospectionQuery {\\n  __schema {\\n    queryType {\\n      name\\n    }\\n    mutationType {\\n      name\\n    }\\n    subscriptionType {\\n      name\\n    }\\n    types {\\n      ...FullType\\n    }\\n    directives {\\n      name\\n      description\\n locations\\n      args {\\n        ...InputValue\\n      }\\n    }\\n  }\\n}\\n\\nfragment FullType on __Type {\\n  kind\\n  name\\n  description\\n  fields(includeDeprecated: true) {\\n    name\\n    description\\n args {\\n      ...InputValue\\n    }\\n    type {\\n      ...TypeRef\\n    }\\n    isDeprecated\\n    deprecationReason\\n  }\\n  inputFields {\\n    ...InputValue\\n  }\\n  interfaces {\\n    ...TypeRef\\n  }\\n  enumValues(includeDeprecated: true) {\\n    name\\n    description\\n    isDeprecated\\n    deprecationReason\\n  }\\n  possibleTypes {\\n    ...TypeRef\\n  }\\n}\\n\\nfragment InputValue on __InputValue {\\n  name\\n  description\\n  type {\\n    ...TypeRef\\n  }\\n  defaultValue\\n}\\n\\nfragment TypeRef on __Type {\\n  kind\\n  name\\n  ofType {\\n    kind\\n    name\\n    ofType {\\n      kind\\n      name\\n      ofType {\\n        kind\\n        name\\n        ofType {\\n          kind\\n          name\\n          ofType {\\n            kind\\n            name\\n            ofType {\\n              kind\\n              name\\n              ofType {\\n                kind\\n                name\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  }\\n}\\n"
    }
}
```

#### `endpoint` <a href="#endpoint" id="endpoint"></a>

This is the endpoint of the call, which is appended to the Connector's base domain.\
In case it uses a different base domain, the entire endpoint URL can be written instead.

#### `body` <a href="#body" id="body"></a>

This is the request body that should be sent to the endpoint.\
If this parameter is present, a `POST` call will be made.

#### `use_connector_auth` <a href="#use_connector_auth" id="use_connector_auth"></a>

*Optional*

This field needs to be set to `true` in case the schema endpoint can only be accessed with a Connector Auth.

## Configuration on action <a href="#configuration-on-action" id="configuration-on-action"></a>

In all actions where the schema should be used for autocomplete, there needs to be a code field with the mode `graphql`, e.g.

```json
"query": {
    "type": "code",
    "mode": "graphql",
    "title": "Query String",
    "info": "GraphQL Query",
    "rows": 2
  }
```

If the field and an external schema configuration are present (and setup correctly), GraphQL autocomplete and validation will show up.

Here it makes sense to have a `graphql_wildcard` action, just like [this one](https://app.locoia.com/#/settings/connector/d5584605-8f99-4b9f-a552-3a442596e352/action?page=1\&perPage=10\&nameSearchString=graphql_wildcard\&selectedTag\&sortProp=name\&sortOrder=ascending).

## Examples <a href="#examples" id="examples"></a>

### Vodafone <a href="#vodafone" id="vodafone"></a>

The necessary details for the external schema config can be found on [Vodafone GK's GraphQL playground page](https://gk4null.de/graphql). When looking in the network tab, there's a request `graphql`, which includes all required details:

<figure><img src="/files/acojJ48EDxgYeGlWqfAA" alt=""><figcaption><p>GraphQL schema request details from https://gk4null.de/graphql</p></figcaption></figure>

```json
{
    "endpoint": "graphql",
    "body": {
      "operationName": "IntrospectionQuery",
      "variables": {},
      "query": "query IntrospectionQuery {\\n  __schema {\\n    queryType {\\n      name\\n    }\\n    mutationType {\\n      name\\n    }\\n    subscriptionType {\\n      name\\n    }\\n    types {\\n      ...FullType\\n    }\\n    directives {\\n      name\\n      description\\n locations\\n      args {\\n        ...InputValue\\n      }\\n    }\\n  }\\n}\\n\\nfragment FullType on __Type {\\n  kind\\n  name\\n  description\\n  fields(includeDeprecated: true) {\\n    name\\n    description\\n args {\\n      ...InputValue\\n    }\\n    type {\\n      ...TypeRef\\n    }\\n    isDeprecated\\n    deprecationReason\\n  }\\n  inputFields {\\n    ...InputValue\\n  }\\n  interfaces {\\n    ...TypeRef\\n  }\\n  enumValues(includeDeprecated: true) {\\n    name\\n    description\\n    isDeprecated\\n    deprecationReason\\n  }\\n  possibleTypes {\\n    ...TypeRef\\n  }\\n}\\n\\nfragment InputValue on __InputValue {\\n  name\\n  description\\n  type {\\n    ...TypeRef\\n  }\\n  defaultValue\\n}\\n\\nfragment TypeRef on __Type {\\n  kind\\n  name\\n  ofType {\\n    kind\\n    name\\n    ofType {\\n      kind\\n      name\\n      ofType {\\n        kind\\n        name\\n        ofType {\\n          kind\\n          name\\n          ofType {\\n            kind\\n            name\\n            ofType {\\n              kind\\n              name\\n              ofType {\\n                kind\\n                name\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  }\\n}\\n"
    }
}
```

### EverReal

EverReal uses a different base domain for the GraphQL schema, thus the entire URL has to be provided in the `endpoint` field.

Copy

```json
{
  "endpoint": "https://app.everreal.co/api/reporting/graphql",
  "body": {
    "operationName": "IntrospectionQuery",
    "variables": {},
    "query": "query IntrospectionQuery {\\n  __schema {\\n    queryType {\\n      name\\n    }\\n    mutationType {\\n      name\\n    }\\n    subscriptionType {\\n      name\\n    }\\n    types {\\n      ...FullType\\n    }\\n    directives {\\n      name\\n      description\\n      locations\\n      args {\\n        ...InputValue\\n      }\\n    }\\n  }\\n}\\n\\nfragment FullType on __Type {\\n  kind\\n  name\\n  description\\n  fields(includeDeprecated: true) {\\n    name\\n    description\\n    args {\\n      ...InputValue\\n    }\\n    type {\\n      ...TypeRef\\n    }\\n    isDeprecated\\n    deprecationReason\\n  }\\n  inputFields {\\n    ...InputValue\\n  }\\n  interfaces {\\n    ...TypeRef\\n  }\\n  enumValues(includeDeprecated: true) {\\n    name\\n    description\\n    isDeprecated\\n    deprecationReason\\n  }\\n  possibleTypes {\\n    ...TypeRef\\n  }\\n}\\n\\nfragment InputValue on __InputValue {\\n  name\\n  description\\n  type {\\n    ...TypeRef\\n  }\\n  defaultValue\\n}\\n\\nfragment TypeRef on __Type {\\n  kind\\n  name\\n  ofType {\\n    kind\\n    name\\n    ofType {\\n      kind\\n      name\\n      ofType {\\n        kind\\n        name\\n        ofType {\\n          kind\\n          name\\n          ofType {\\n            kind\\n            name\\n            ofType {\\n              kind\\n              name\\n              ofType {\\n                kind\\n                name\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  }\\n}\\n"
  }
}
```

### Monday <a href="#monday" id="monday"></a>

Monday's schema can be found directly on their base domain, thus the `endpoint` field is just an empty string.

However, to read the schema details, authentication must also be sent in the request. Thus, `"use_connector_auth": true` has to be included.

```json
{
  "endpoint": "",
  "body": {
    "query": "\\n    query IntrospectionQuery {\\n      __schema {\\n        queryType { name }\\n        mutationType { name }\\n        subscriptionType { name }\\n        types {\\n          ...FullType\\n        }\\n        directives {\\n          name\\n          description\\n          locations\\n          args {\\n            ...InputValue\\n          }\\n        }\\n      }\\n    }\\n\\n    fragment FullType on __Type {\\n      kind\\n      name\\n      description\\n      fields(includeDeprecated: true) {\\n        name\\n        description\\n        args {\\n          ...InputValue\\n        }\\n        type {\\n          ...TypeRef\\n        }\\n        isDeprecated\\n        deprecationReason\\n      }\\n      inputFields {\\n        ...InputValue\\n      }\\n      interfaces {\\n        ...TypeRef\\n      }\\n      enumValues(includeDeprecated: true) {\\n        name\\n        description\\n        isDeprecated\\n        deprecationReason\\n      }\\n      possibleTypes {\\n        ...TypeRef\\n      }\\n    }\\n\\n    fragment InputValue on __InputValue {\\n      name\\n      description\\n      type { ...TypeRef }\\n      defaultValue\\n    }\\n\\n    fragment TypeRef on __Type {\\n      kind\\n      name\\n      ofType {\\n        kind\\n        name\\n        ofType {\\n          kind\\n          name\\n          ofType {\\n            kind\\n            name\\n            ofType {\\n              kind\\n              name\\n              ofType {\\n                kind\\n                name\\n                ofType {\\n                  kind\\n                  name\\n                  ofType {\\n                    kind\\n                    name\\n                  }\\n                }\\n              }\\n            }\\n          }\\n        }\\n      }\\n    }\\n  "
  },
  "use_connector_auth": true
}
```


---

# 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.locoia.com/connectors/building-connectors/base-connector-setup/graphql-apis.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.
