Skip to content

delete multiple builds not working #37

Description

@SassNinja

When I use the curl example from the docs it works without any problem

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

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.

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 :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions