The DigitalOcean Product Documentation team is excited to share a new feature that we hope will make it even easier for customers to test our API, troubleshoot issues, and learn new skills. The API “Try it out” feature allows DigitalOcean customers to test API calls directly from the product documentation website. This enables our customers to securely explore what our API has to offer them without setting up test environments or third-party API platforms.
The “Try the API” page uses the popular Swagger protocol to render DigitalOcean’s OpenAPI spec into a documentation reference. The reference not only documents our API calls, but also allows customers to authenticate, format, and make HTTP requests to their DigitalOcean account from the documentation itself.
For example, you can format a POST request that creates a Droplet from the Droplet section of the doc, or you can make a GET request to retrieve your account’s billing information from the Billing section. Swagger renders the JSON responses on the page.
To use the “Try it out” functionality, you need a DigitalOcean API key. You can follow the steps in our documentation to create a key and set its permissions to whatever you feel comfortable with.
Once you have an API key, open the Try-It-Now page and click on the “Authorize” button, or any of the lock icons beside the API calls, to open the authorization screen and enter your API key.
Swagger then stores the API key as a Javascript variable in its local state. This means that the key will be erased from your browser’s memory if the tab is closed or the page is refreshed. For security purposes, the page does not store the key in local or session storage.
Once you have entered the API key, select an API call from the page and click the Try it out! button. Configure any parameters or requests bodies as necessary, and then click Execute. The page makes the HTTP request to your account and returns a response. That’s it!
We hope this makes it easier to see what our API can do for you and can’t wait for you to try the “Try it out!” documentation feature!