Question

Add droplet by API to LoadBalancer return error

I tried this command ( the token and the dropletids has been edited)

curl -X POST
-H “Content-Type: application/json”
-H “Authorization: Bearer aaaaaaaaaaa”
-d ‘{“droplet_ids”: [327455XXX,327455XXX]}’
https://api.digitalocean.com/v2/load_balancers/a6929bc5-2df6-48d7-a0d1-dc9eb5de5feb/droplets

But always return {“id”:“unprocessable_entity”,“message”:“only one target identifier (e.g. tag, droplets) can be specified”,“request_id”:“436541b0-7f36-4eb4-8c00-c05fae5c0693”}

I had this code working for more than 2 years but since 2 months doesnt work (I also changed the old token for a new one… with the new token I can create droplets or delete it but not add to the LoadBalancer)


Submit an answer


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!

Sign In or Sign Up to Answer

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.

KFSys
Site Moderator
Site Moderator badge
November 21, 2022

Hi @sergiob5ce772fe6d9daca9c85,

By checking the Api DOCS:

I’ve seen the request should be like this:

  1. curl -X POST \
  2. -H "Content-Type: application/json" \
  3. -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  4. -d '{"droplet_ids": [3164446, 3164447]}' \
  5. "https://api.digitalocean.com/v2/load_balancers/4de7ac8b-495b-4884-9a69-1050c6793cd6/droplets"

and the post request to be for https://api.digitalocean.com/v2/load_balancers/{lb_id}/droplets.

Is it possible you’ve provided the wrong LB_ID in your post request?

FUUUUUUUUUUUUUUUUUUUUUuuuuuuuuuuuuuuuuuuuuuuuuuuu After 2 hours… I see that LoadBalancer has configured a TAG… xD

Another question, how change the tag of LB ?

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up