Skip to main content

droplets

Creates, updates, deletes, gets or lists a droplets resource.

Overview

Namedroplets
TypeResource
Iddigitalocean.droplets.droplets

Fields

NameDatatypeDescription
column_anon``

Methods

NameAccessible byRequired ParamsDescription
droplets_getSELECTdroplet_idTo show information about an individual Droplet, send a GET request to /v2/droplets/$DROPLET_ID.
droplets_listSELECTTo list all Droplets in your account, send a GET request to /v2/droplets. The response body will be a JSON object with a key of droplets. This will be set to an array containing objects each representing a Droplet. These will contain the standard Droplet attributes. ### Filtering Results by Tag It's possible to request filtered results by including certain query parameters. To only list Droplets assigned to a specific tag, include the tag_name query parameter set to the name of the tag in your GET request. For example, /v2/droplets?tag_name=$TAG_NAME. ### GPU Droplets By default, only non-GPU Droplets are returned. To list only GPU Droplets, set the type query parameter to gpus. For example, /v2/droplets?type=gpus.
droplets_createINSERTTo create a new Droplet, send a POST request to /v2/droplets setting the required attributes. A Droplet will be created using the provided information. The response body will contain a JSON object with a key called droplet. The value will be an object containing the standard attributes for your new Droplet. The response code, 202 Accepted, does not indicate the success or failure of the operation, just that the request has been accepted for processing. The actions returned as part of the response's links object can be used to check the status of the Droplet create event. ### Create Multiple Droplets Creating multiple Droplets is very similar to creating a single Droplet. Instead of sending name as a string, send names as an array of strings. A Droplet will be created for each name you send using the associated information. Up to ten Droplets may be created this way at a time. Rather than returning a single Droplet, the response body will contain a JSON array with a key called droplets. This will be set to an array of JSON objects, each of which will contain the standard Droplet attributes. The response code, 202 Accepted, does not indicate the success or failure of any operation, just that the request has been accepted for processing. The array of actions returned as part of the response's links object can be used to check the status of each individual Droplet create event.
droplets_destroyDELETEdroplet_idTo delete a Droplet, send a DELETE request to /v2/droplets/$DROPLET_ID. A successful request will receive a 204 status code with no body in response. This indicates that the request was processed successfully.
droplets_destroy_by_tagDELETEtag_nameTo delete all Droplets assigned to a specific tag, include the tag_name query parameter set to the name of the tag in your DELETE request. For example, /v2/droplets?tag_name=$TAG_NAME. A successful request will receive a 204 status code with no body in response. This indicates that the request was processed successfully.
droplets_destroy_retry_with_associated_resourcesEXECdroplet_idIf the status of a request to destroy a Droplet with its associated resources reported any errors, it can be retried by sending a POST request to the /v2/droplets/$DROPLET_ID/destroy_with_associated_resources/retry endpoint. Only one destroy can be active at a time per Droplet. If a retry is issued while another destroy is in progress for the Droplet a 409 status code will be returned. A successful response will include a 202 response code and no content.
droplets_destroy_with_associated_resources_dangerousEXECX-Dangerous, droplet_idTo destroy a Droplet along with all of its associated resources, send a DELETE request to the /v2/droplets/$DROPLET_ID/destroy_with_associated_resources/dangerous endpoint. The headers of this request must include an X-Dangerous key set to true. To preview which resources will be destroyed, first query the Droplet's associated resources. This operation can not be reverse and should be used with caution. A successful response will include a 202 response code and no content. Use the status endpoint to check on the success or failure of the destruction of the individual resources.
droplets_destroy_with_associated_resources_selectiveEXECdroplet_idTo destroy a Droplet along with a sub-set of its associated resources, send a DELETE request to the /v2/droplets/$DROPLET_ID/destroy_with_associated_resources/selective endpoint. The JSON body of the request should include reserved_ips, snapshots, volumes, or volume_snapshots keys each set to an array of IDs for the associated resources to be destroyed. The IDs can be found by querying the Droplet's associated resources. Any associated resource not included in the request will remain and continue to accrue changes on your account. A successful response will include a 202 response code and no content. Use the status endpoint to check on the success or failure of the destruction of the individual resources.

SELECT examples

To list all Droplets in your account, send a GET request to /v2/droplets. The response body will be a JSON object with a key of droplets. This will be set to an array containing objects each representing a Droplet. These will contain the standard Droplet attributes. ### Filtering Results by Tag It's possible to request filtered results by including certain query parameters. To only list Droplets assigned to a specific tag, include the tag_name query parameter set to the name of the tag in your GET request. For example, /v2/droplets?tag_name=$TAG_NAME. ### GPU Droplets By default, only non-GPU Droplets are returned. To list only GPU Droplets, set the type query parameter to gpus. For example, /v2/droplets?type=gpus.

SELECT
column_anon
FROM digitalocean.droplets.droplets
;

INSERT example

Use the following StackQL query and manifest file to create a new droplets resource.

/*+ create */
INSERT INTO digitalocean.droplets.droplets (
data__name,
data__region,
data__size,
data__image,
data__ssh_keys,
data__backups,
data__backup_policy,
data__ipv6,
data__monitoring,
data__tags,
data__user_data,
data__private_networking,
data__volumes,
data__vpc_uuid,
data__with_droplet_agent
)
SELECT
'{{ name }}',
'{{ region }}',
'{{ size }}',
'{{ image }}',
'{{ ssh_keys }}',
'{{ backups }}',
'{{ backup_policy }}',
'{{ ipv6 }}',
'{{ monitoring }}',
'{{ tags }}',
'{{ user_data }}',
'{{ private_networking }}',
'{{ volumes }}',
'{{ vpc_uuid }}',
'{{ with_droplet_agent }}'
;

DELETE example

Deletes the specified droplets resource.

/*+ delete */
DELETE FROM digitalocean.droplets.droplets
WHERE tag_name = '{{ tag_name }}';