Digitalocean api: Difference between revisions
From wikinotes
No edit summary |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| API documentation || | | API documentation || https://docs.digitalocean.com/reference/api/ | ||
|- | |- | ||
|} | |} | ||
Line 18: | Line 18: | ||
|} | |} | ||
</blockquote><!-- api clients --> | </blockquote><!-- api clients --> | ||
= Authentication = | |||
<blockquote> | |||
You'll need a token before you can do anything. | |||
<syntaxhighlight lang="yaml"> | |||
digitalocean.com: | |||
API: | |||
tokens/keys: | |||
- Generate New Token | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | |||
# list all droplets | |||
export TOKEN=${YOUR_TOKEN} | |||
curl -X GET "https://api.digitalocean.com/v2/droplets" \ | |||
-H "Authorization: Bearer $TOKEN" \ | |||
| jq | |||
</syntaxhighlight> | |||
</blockquote><!-- Authentication --> |
Latest revision as of 03:22, 9 February 2022
digitalocean exposes an api to manipulate their droplets/services.
Documentation
API documentation https://docs.digitalocean.com/reference/api/
API Clients
python python-digitalocean
Authentication
You'll need a token before you can do anything.
digitalocean.com: API: tokens/keys: - Generate New Token# list all droplets export TOKEN=${YOUR_TOKEN} curl -X GET "https://api.digitalocean.com/v2/droplets" \ -H "Authorization: Bearer $TOKEN" \ | jq