By balterm
This is the error message I am getting. The error is intermittent: digitalocean.baseapi.DataReadError: Error processing request to tags server: Deadline Exceeded. Please try again.
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!
Hi there,
Just a quick follow up in case anyone comes across this in the future.
This should now be working as expected, here is the reference to the API docs:
https://docs.digitalocean.com/reference/api/api-reference/#operation/tags_assign_resources
The curl request to tag a resource would look like this:
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
-d '{"resources":[{"resource_id":"9569411","resource_type":"droplet"},{"resource_id":"7555620","resource_type":"image"},{"resource_id":"3d80cb72-342b-4aaa-b92e-4e4abb24a933","resource_type":"volume"}]}' \
"https://api.digitalocean.com/v2/tags/awesome/resources"
The above translated to Python:
import requests
import json
url = "https://api.digitalocean.com/v2/tags/awesome/resources"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {DIGITALOCEAN_TOKEN}"
}
data = {
"resources": [
{"resource_id": "9569411", "resource_type": "droplet"},
{"resource_id": "7555620", "resource_type": "image"},
{"resource_id": "3d80cb72-342b-4aaa-b92e-4e4abb24a933", "resource_type": "volume"}
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.