get 500 code when trying to create more than 1 droplet per a request

when I tried to create just one droplet using the API I succeed but when I tried to create more than 1 droplet per request I get server error (500 status code!)

the docs says use array of names and that’s what I did… “Creating multiple Droplets is very similar to creating a single Droplet, but instead of sending name as a string, send names as an array.”

My code…

TOCKEN = "xxxxxxxx"
endpoint = ''
headers = {"Content-Type": "application/json", "Authorization": "Bearer {}".format(TOCKEN) }
params = {'region': "nyc3", 'size': "512mb", 'image': "centos-7-0-x64"}

def create_droplet(info, numb):

    x = {'names': ["Tempo" + str(x) for x in range(0, numb)]}


print(create_droplet(params, 2).status_code)

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @hamo220058

It looks correct, but shouldn’t you only send to without the / in the end? I haven’t tested, but that was just the first thing I noticed. If it doesn’t work, then I’ll try to run your script through my local python environment.