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

Fetching a Single Object

PreviousExamplesNextFetching all Plans for your Organization

Last updated 2 years ago

Was this helpful?

If you look at the reference documentation you can see on the top level there is a node query. This query can fetch any object which implements the Node interface, which is almost every object in our API. The Node interface defines just one field, the id field, so you have to use an what to do for specific types. Below is some simple examples of how this works.

In this example we'll use the Example Map Plan everyone sees when they first log into DroneDeploy. This has the ID of MapPlan:5a3d7badf014ce3db3c22391 . You can see the IDs of your own plans by listing your organizations plans,

The simplest example of using the node query is

query getMap{
  node(id:"MapPlan:5a3d7badf014ce3db3c22391"){
    id
  }
}

Since the node query returns a Node object, the only field available is id. This isn't very useful, what you want is the fields specific to the MapPlan type. For this you use an : You can try this out

query getMap{
  node(id:"MapPlan:5a3d7badf014ce3db3c22391"){
    ... on MapPlan{
      name
      location {
        lat
        lng
      }
      imageCount
      status
    }
  }
}

Which returns the data:

{
  "data": {
    "node": {
      "name": "Construction Example",
      "location": {
        "lat": 28.64861527777778,
        "lng": -81.5398111111111
      },
      "imageCount": 438,
      "status": "COMPLETE"
    }
  }
}

When you specify the type it allows you to query the fields for that specific type.

Inline Fragment
shown here.
this.
Inline Fragment
here.