Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Set build state through API - Nodejs

sebsundin August 15, 2019

Hi! We’re currently trying to set our build-status through an API call but we can’t seem to figure out how it’s supposed to be done. When sending a get request to a specific commit, we get all the information about said commit. So authorization seems to be working fine.

But when changing our axios call to a POST request to the build-endpoint, we run into a Bad Request error. The docs does not seem to specify what should be put into the request body, so we’re currently at kind of a dead end. Does any one know how to make a correct post-request to set a build status to Successfull?

docs: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/commit/%7Bnode%7D/statuses/build

Code:


axios({

method: 'POST',

url: `https://api.bitbucket.org/2.0/repositories/COMPANYNAME/REPO/commit/SHA1/statuses/build`,

headers: {

Authorization: `Bearer ${token}`

},

data: {

state: 'SUCCESSFULL',

key: 'put key here',

url: 'put url here' }

})

.then(response => {

console.log(response);

})

.catch(err => {

console.log(err);

});

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events