Skip to main content

tags

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

Overview

Nametags
TypeResource
Iddigitalocean.tags.tags

Fields

NameDatatypeDescription
namestringThe name of the tag. Tags may contain letters, numbers, colons, dashes, and underscores. There is a limit of 255 characters per tag. Note: Tag names are case stable, which means the capitalization you use when you first create a tag is canonical. When working with tags in the API, you must use the tag's canonical capitalization. For example, if you create a tag named "PROD", the URL to add that tag to a resource would be https://api.digitalocean.com/v2/tags/PROD/resources (not /v2/tags/prod/resources). Tagged resources in the control panel will always display the canonical capitalization. For example, if you create a tag named "PROD", you can tag resources in the control panel by entering "prod". The tag will still display with its canonical capitalization, "PROD".
resourcesobjectTagged Resource Statistics include metadata regarding the resource type that has been tagged.

Methods

NameAccessible byRequired ParamsDescription
tags_getSELECTtag_idTo retrieve an individual tag, you can send a GET request to /v2/tags/$TAG_NAME.
tags_listSELECTTo list all of your tags, you can send a GET request to /v2/tags.
tags_createINSERTTo create a tag you can send a POST request to /v2/tags with a name attribute.
tags_deleteDELETEtag_idA tag can be deleted by sending a DELETE request to /v2/tags/$TAG_NAME. Deleting a tag also untags all the resources that have previously been tagged by the Tag

SELECT examples

To list all of your tags, you can send a GET request to /v2/tags.

SELECT
name,
resources
FROM digitalocean.tags.tags
;

INSERT example

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

/*+ create */
INSERT INTO digitalocean.tags.tags (
data__name,
data__resources
)
SELECT
'{{ name }}',
'{{ resources }}'
;

DELETE example

Deletes the specified tags resource.

/*+ delete */
DELETE FROM digitalocean.tags.tags
WHERE tag_id = '{{ tag_id }}';