digitalocean-node icon indicating copy to clipboard operation
digitalocean-node copied to clipboard

unable to client.droplets.deleteByTag

Open rjperrella opened this issue 5 years ago • 5 comments

Hi, I've used this package for years and I love it. Recently, however, it appears that client.droplets.deleteByTag() doesn't work. When I put a debug statement (console.log) in client.js, in _makeRequestWithBody, I can see that it builds this object: { uri: 'https://api.digitalocean.com/v2/droplets', method: 'DELETE', headers: { Authorization: 'Bearer bla bla bla' }, body: '{"tag_name":"GH"}' }

In the DigitalOcean API docs I see: To delete Droplets by a tag (for example awesome), send a DELETE request to v2/droplets?tag_name=$TAG_NAME.

So, If I understand the DigitalOcean API correctly, I think the tag_name needs to be part of the URI, not part of the body. However, I'm not sure how to correct this. Thanks.

rjperrella avatar Mar 02 '20 13:03 rjperrella

Interesting - maybe they changed things so that bodies in DELETEs are no longer valid. We’d need to update the params passed to makeRequestWithBody from deleteByTag.

On Mon, Mar 2, 2020 at 8:41 AM Ronald Perrella [email protected] wrote:

Hi, I've used this package for years and I love it. Recently, however, it appears that client.droplets.deleteByTag() doesn't work. When I put a debug statement (console.log) in client.js, In _makeRequestWithBody, I can see that it builds this object: { uri: 'https://api.digitalocean.com/v2/droplets', method: 'DELETE', headers: { Authorization: 'Bearer bla bla bla' }, body: '{"tag_name":"GH"}' }

If I understand the DigitalOcean API correctly, I think the tag_name needs to be part of the URI, not part of the body. However, I'm not sure how to correct this. Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/phillbaker/digitalocean-node/issues/34?email_source=notifications&email_token=AAAXCKJA3QPFIEE26QTMGN3RFOZPXA5CNFSM4K7UQA7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IRWI34Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAXCKLMRJHUQBRE6HWX4BTRFOZPXANCNFSM4K7UQA7A .

phillbaker avatar Mar 02 '20 14:03 phillbaker

I don't call this API very often but it certainly used to work (say, a year ago?)

rjperrella avatar Mar 02 '20 15:03 rjperrella

Sorry my bad - closed accidentally.

rjperrella avatar Mar 02 '20 16:03 rjperrella

Do you accept PRs?

Brostafa avatar May 14 '20 11:05 Brostafa

Do you accept PRs?

Yup!

phillbaker avatar May 14 '20 12:05 phillbaker