Hi, A GET request to “https://api.digitalocean.com/v2/sizes” should return a list of the available sizes. But when i try with
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer ****" "https://api.digitalocean.com/v2/sizes" | jq ".sizes | .slug"
I have tried to resize a machine to a not-listed-above “c-16” size and its works! So my question is, why it is missing from the list returned by “/v2/sizes” ?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
List responses from the DigitalOcean API are paginated. By default, only 20 items are listed in the first page. For example, this will return 20:
If we made this query without the
jqfilter, we would see the response contains:
This indicates that there are additional results that can be accessed on the next page by appending the
page=2query parameter to the request.
If you want to access more than 20 results per page, you can adjust this using the
per_pagequery parameter. The maximum number of results in a page is 200. So adjusting our request to use
we get 29 results. Also, the
linkssection of the response will be empty indicating that there are no additional pages.
Unfortunately, the API lists only sizes that are unlocked to you. I think the default is limited to sizes up to 100 USD/month. In the console, you can request to unlock larger sizes. It would be great if the API would list all sizes with an “unlocked” flag, instead, but this is not the case.