# Introduction

At DroneDeploy we use GraphQL for our main API technology, you can get started with the [API explorer here](https://www.dronedeploy.com/graphiql/).

## What is GraphQL?

GraphQL Is a query language for clients to fetch the data they need from the API. Fundamentally it is:

* A [**specification**](https://spec.graphql.org/October2021/); the specification defines what data can be fetched or updated and defines the format of the response
* Strongly typed; GraphQL has a well defined type system which defines what each field in the API can be and guarantees that it will be that.
* Well structured; the schema not only defines the types of objects and their fields but also defines the links between complex objects. Queries can fetch single objects or traverse the links in the structure to fetch all of the required information in a single query.

### Why use GraphQL?

We are using GraphQL primarily because it allows developers to make API calls which gets them exactly what data they need in the simplest way possible. Since it is a well structured schema you can fetch data and know that you will get the data back in a guaranteed format and because of that, tooling can make development significantly easier.

### Making GraphQL Queries

You can use our API explorer to graphically make API calls: <https://www.dronedeploy.com/graphiql/>

The requests are made making a POST to the \`/graphql\` endpoint, you can make these with CURL or any HTTP compatible client.

One of the top level objects in the query schema is the `viewer` object. This is the User object of the currently logged in user. To query for the currently logged in users username you use the following example:

You can explore this query[ here.](https://www.dronedeploy.com/graphql?query=%7B%20viewer%7B%20username%20%20%0A%7D%20%7D)

```
{
  viewer{
    username    
  }
}
```

Returns:

```javascript
{
  "data": {
    "viewer": {
      "username": "docs@dronedeploy.com"
    }
  }
}
```

The API Explorer is making this request:

```
Content-Type: 
POST /graphql
{
    "query": "{ viewer { username }}"
}
```

You could also make the call using `curl`

```
curl -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer <api key>' \
     -d '{"query": "{ viewer { username }}"}' \
     https://www.dronedeploy.com/graphql
```

## Useful Links:

* The official query documentation is here: <http://graphql.org/learn/queries/>&#x20;
* The official tutorials for learning the basics of GraphQL is here: <http://graphql.org/learn/>


---

# 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://developer-docs.dronedeploy.com/api/introduction.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.
