API Reference
Log In
API Reference

/api/drone/{name|id}

Description

Update metadata in your drone object on all fields that are not read-only. See Anatomy of a Drone Object for more information.

Using Groups

There is a special rule for updating groups in a drone object.

To update a group object, you must use an object, and preface it with one of the three fields: $set, $push, $pull. Then, include the array of groups. The field dictates how you wish to modify the group. You can have multiple $set, $push, and $pull operations in your group field, but the behavior of how it will affect the groups is undefined, as it depends on how the JSON object is iterated, which is arbitrary and implementation dependent. It is recommended to only use one of these fields per group update at a time.

Set

$set is used to do a fresh update on a group. This removes the existing group names and add the new group names, or if an empty array is used, no groups.

Example:
Old Drone object: {groups: [swarm-12, vegas]}
Update value: groups: {$set: [swarm-32, kansas, multirotor] }
New value: {groups: [swarm-32, kansas, multirotor]}

Pull

$pull is used to remove groups from a drone object. Any groups in the drone object that matches the array specified by $pull will be removed. If there is no match, no change is made.

Example:
Old Drone object: {groups: [swarm-12, vegas]}
Update value: groups: {$pull: [swarm-32, vegas] }
New value: {groups: [swarm-12]}

Push

$push is used to add groups to a drone object. Any groups in the drone object that matches the array specified by $pull will be added. Existing groups remain unchanged.

Example:
Old Drone object: {groups: [swarm-12, vegas]}
Update value: groups: {$push: [swarm-32, vegas] }
New value: {groups: [swarm-12, swarm-32, vegas]}

Language
Credentials