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

Problems creating label using REST API and curl

dlee January 9, 2012

I'm trying to use the REST API to label builds. Can someone tell me what curl syntax to use to make this work?

The permutations I've tried are:

$ curl --fail -X POST --user ${BAMBOO_USER}:${BAMBOO_PASSWORD} "${BAMBOO}/rest/api/latest/result/${BUILD_KEY}/label" -d "<label name="release"/>" -H "Content-type: text/xml"
curl: (22) The requested URL returned error: 415

$ curl --fail -X POST --user ${BAMBOO_USER}:${BAMBOO_PASSWORD} "${BAMBOO}/rest/api/latest/result/${BUILD_KEY}/label" -H "Content-type: text/xml" <<EOF
<label name="release"/>
EOF
curl: (22) The requested URL returned error: 415

I've also tried it both ways without the -H option.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
rich
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 10, 2012

Try this:

curl -v -X POST --user ${BAMBOO_USER}:${BAMBOO_PASSWORD} "${BAMBOO}/rest/api/latest/result/{projectKey}-{buildKey}-{buildNumber}/label" -d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><label name="release"/>' -H "Content-type: application/xml"
 

dlee January 10, 2012

Should have notices I was using text/ instead of application/. *blushes*

TAGS
AUG Leaders

Atlassian Community Events