doapi-request — perform a raw DigitalOcean API request
doapi-request [<universal options>] [-d|--data <string|@file>] [-D|--dump-header <file>] [--paginate <key>] [-X|--request <method>] <URL>|<path>
doapi-request makes a request to a DigitalOcean API endpoint and outputs the text of the response (if any) as nicely-formatted JSON. It’s like a DigitalOcean-centric curl(1) that doesn’t make you type out your API token every time, with an option for handling pagination.
A request can be made either to an absolute URL or to a path like
/v2/account that will be appended to the API endpoint in use.
In addition to the universal options common to all doapi commands, doapi-request takes the following:
Send the given data (which must be valid JSON) in the body of the request. If
<data>begins with “
@”, the rest of the argument (if there is any) is treated as a file from which to read the data; a filename of
-causes data to be read from standard input.
Dump the headers of the HTTP response as a JSON object to the given file. If
--paginateis also used, only the headers for the last response will be dumped.
-to write the headers to standard output.
GETmethod only) Assume that the API will respond with a paginated list of one or more values, i.e., an object containing a field
<key>mapped to a list of values and a field
"links"containing a URL for retrieving the next set of values in the result list, if any. Instead of performing a single request and outputting the response body, doapi-requests will perform multiple requests to retrieve all of the pages and will output a concatenated list of all of the values in the
<key>field of each page.
Specifies the HTTP method to use for the request. Valid options are