The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

setting default branch returns "unknown field" error

Justin Morrison
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 17, 2012

Running this:

curl -u user:pwd -X PUT -H "Accept: application/json" -H "Content-type: application/json" -d "{\"name\":\"development\"}" http://git.somewhere.com/rest/api/1.0/projects/TM/repos/myrepo/branches/default

Yields this:

{"errors":[{"context":"name","message":"Unrecognized field \"name\" (Class com.atlassian.stash.rest.data.RestBranch), not marked as ignorable\n at [Source: org.apache.catalina.connector.CoyoteInputStream@18c82cf; line: 1, column: 10] (through reference chain: com.atlassian.stash.rest.data.RestBranch[\"name\"])","exceptionName":null}]}

The API browser offers no suggestion of what the field name is supposed to be. I've tried 'branch' and 'default' as the field name, neither of which work.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
seb
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 17, 2012

Try this:

curl -u user:pwd -X PUT -H "Accept: application/json" -H "Content-type: application/json" -d "{\"id\":\"development\"}" http://git.somewhere.com/rest/api/1.0/projects/TM/repos/myrepo/branches/default

(the json should use the "id" property, not "name".

Justin Morrison
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 17, 2012

That worked. Thank you for your help.

Is there any way those field names could be documented somewhere, such as the API Browser?

seb
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 17, 2012

We will be documenting these fields, sorry for the inconvenience!

TAGS
AUG Leaders

Atlassian Community Events