DroneDeploy
  • Introduction
  • Introduction
    • Overview
  • API
    • Introduction
    • Authentication
    • Pagination
    • Examples
      • Fetching a Single Object
      • Fetching all Plans for your Organization
      • Fetching Exports
      • Creating an Export
Powered by GitBook
On this page

Was this helpful?

  1. API
  2. Examples

Creating an Export

PreviousFetching Exports

Last updated 2 years ago

Was this helpful?

Our APIs are not just for viewing data, you can also create data with

For these examples you will need to substitute your own Plan IDs.

The easiest way to try these APIs is to use the . This has useful features like autocomplete (ctrl+space) and query/input validation.

mutation{
  createExport(input:{planId: "MapPlan:5a0ddee5a6b7d90aecdc2f1d", parameters:{layer:ORTHOMOSAIC}}){
    export{
      id
    }
  }
}

Here the createExport mutation takes an input of planId and parameters. In parameters only the layer is required.

This will create the export and then query for the exports id in the response:

{
  "data": {
    "createExport": {
      "export": {
        "id": "Export:5ab169ed8904ec000136eac9"
      }
    }
  }
}

Using Variables

To take the query above and use variables you need to do 3 things:

  1. Define the variable in the mutation signature:

    mutation($input:CreateExportInput!){

  2. Use the defined variable in the mutation:

    createExport(input:$input){

  3. Define the value of the variable in the variables section of the JSON payload

mutation($input:CreateExportInput!){
  createExport(input:$input){
    export{
      id
    }
  }
}

With the variables:

{
  "input":{
    "planId": "MapPlan:5a0ddee5a6b7d90aecdc2f1d",
    "parameters": {
        "layer": "ORTHOMOSAIC"
    }
  }
}

The raw request looks like:

Authorization: Bearer <api_key>
POST /graphql
{
  "query": "mutation CreateExport($input:CreateExportInput!){createExport(input:$input){export{id}}}",
  "variables": {
    "input": {
      "planId": "MapPlan:5a0ddee5a6b7d90aecdc2f1d",
      "parameters": {
        "layer": "ORTHOMOSAIC"
      }
    }
  }
}

You can then use the steps in to check on the status of that export.

As the input gets more complex you will want to use GraphQL variables. For some background information on Variables in Mutations, .

mutations.
API Explorer
Fetching Exports
see here
This transforms the query to the following: