When I use the curl example from the docs it works without any problem ```bash curl -u "xxxx:xxxx" -X DELETE "https://api.browserstack.com/automate/builds?buildId=xxxx" ``` but when I try to do the same with node I always get a 302 redirect error ```javascript const request = require('request') request({ url: 'https://api.browserstack.com/automate/builds?buildId=xxxx', method: 'DELETE', auth: { user: 'xxxx', pass: 'xxxx' } }, (err, res, body) => { if (res.statusCode === 201) { console.log('success') } else { console.log('error: ' + res.statusCode) console.log(body) } }) ``` the code above logs ``` error: 302 <html><body>You are being <a href="https://api.browserstack.com/users/sign_in">redirected</a>.</body></html> ``` When I modify the code to e.g. change the status of a session it works. ```javascript request({ url: `https://api.browserstack.com/automate/sessions/xxxx.json`, method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: `{"status":"error"}`, auth: { user: 'xxxx', pass: 'xxxx' } }) ``` Is there any internal difference I need to consider when trying to modify multiple items? I really have no idea what's wrong with the node code :/
Activity
rchougule commentedon Sep 3, 2019
Hi @SassNinja,
We are working on updating few things at the back.
Meanwhile, add the following Accept header to make it work.
Let me know if you still face any issue.
Thanks for reaching out.
~ Rohan Chougule