How do you add labels via the API?
When creating a story via the API, I'd like to add labels to the story. I would expect for something like the following to work (in Ruby), but it doesn't:
Story.create(:name => 'Story Name', :labels => 'label1, label2', :project_id => PROJECT_ID)
which would add 'label1' and 'label2' to the story. Is there a way to add labels to the story via the API?
Story.create(:name => 'Story Name', :labels => 'label1, label2', :project_id => PROJECT_ID)
which would add 'label1' and 'label2' to the story. Is there a way to add labels to the story via the API?
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
The company marked this question as answered.
-
Inappropriate?ok, more info: I now see that the API supposedly supports 'labels' (I should have read the API documentation page more closely), but now I think that there's a bug in the API - labels are not actually created when a story is created. I've tried a number of approaches -- I've created the story via curl, updated a story via curl, created a story via ActiveResource, and updated a story via ActiveResource. All of the attributes of a story can be successfully created and updated via either ActiveResource or curl (story name, description, estimate, etc.) with the sole exception of labels (so I'm pretty sure my ActiveResource & curl calls are correct). If I add <labels>Foo</labels> to the XML for a story for curl (or :labels => 'Foo' to the ActiveResource call), the story is successfully created, but the label 'Foo' is not attached to the story. Seems like an API bug to me . . .
I’m frustrated
-
Inappropriate?More info about the bug: I figured out via extensive trial and error that if Tracker & the icebox are open in a browser while the story is being created via the API (assuming the new story is going into the icebox), then the labels are not associated with the newly created story; if the project is not open in Tracker (you can even be on the dashboard -- the key is that the project itself not be open in a browser tab), then the labels are in fact associated with the story. This is 100% reproducible (give it a try yourself!), and appears to be a subtle bug with the API. At least I have a work around now -- just make sure Tracker isn't open while I'm doing API operations, but it seems like something you guys should eventually fix.
I’m feeling better
-
Inappropriate?Hi Greg,
Thanks for reporting the bug and all of your investigative work. It looks like the API is correctly saving the story and label data to the database, but open browsers are not being updated correctly. If you refresh the project page the story will show up correctly.
I've added a bug and we'll try to get it fixed as soon as possible.
Thanks again,
Mark -
Inappropriate?Hi Greg,
Labels should now show via API, thanks again for reporting the problem and including all of the details.
Mark
Loading Profile...


