Command line tool for easily making API calls to Digital Ocean to inspect the state of components
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
SHA256SUMS
digitalocean-api-query

README.md

digitalocean-api-query

An all-bash (+ curl) command line tool for easily making API calls to Digital Ocean to inspect the state of components.

Supports the following Digital Ocean (v2) API calls for query

Set your environment variable before use

Set either DO_TOKEN or TF_VAR_do_token to your Digital Ocean API key value before using digitalocean-api-query since requests all require authentication. The TF_VAR_do_token environment variable is designed to be handy if you are also using Terraform among your toolset.

For example:

 $ export DO_TOKEN=122e68eac3d39a245df747f2d2a2c9c5f4c97c84e3f1463c625492cce1e622cd

Example requests

obtain droplet data using 'jq' to pretty-print the response data

 $ digitalocean-api-query droplets | jq .

obtain a list of droplet.id using 'jq' to filter the response data

 $ digitalocean-api-query droplets | jq .droplets[].id

obtain a list of volume.id slugs using 'jq' to filter the response data

 $ digitalocean-api-query volumes | jq .volumes[].id

obtain a list of region slugs using 'jq' to filter the response data

 $ digitalocean-api-query regions | jq .regions[].slug

Install

digitalocean-api-query is a straight-forward bash script so you can simply download directly and place somewhere useful to you - the sha256sum value is available to confirm integrity, use it.

Authors

This code is managed by Verb Networks.

License

Apache 2 Licensed. See LICENSE file for full details.