API endpoints for adding and removing specific labels
Problem to solve
Currently, it seems like the only way to add/remove labels from an issue, is to make a PUT request to that issue with the new list of labels. If I want to add a label, regardless of which labels the issue currently have, I need to first GET the issue, look at what labels it have, and then make the PUT request accordingly.
Apart from being an extra API call that I would rather avoid, this introduces a race condition since I will overwrite any changes to labels that happens in-between my two requests.
Intended users
Unknown
Further details
Proposal
I think it would be great if we could add two new endpoints to manage labels on issues, in addition to setting the entire list:
PUT /projects/:id/issues/:issue_iid/labels/:label_nameDELETE /projects/:id/issues/:issue_iid/labels/:label_name
These two endpoint would add/remove the specific label from the list, without the race condition.
Permissions and Security
The permissions would be exactly the same as setting the labels field on an issue via a PUT request.
Documentation
There should be API documentation added for the two new routes.
Testing
What risks does this change pose? Since the change is additive it shouldn't impact any existing functionality.
How might it affect the quality of the product? The quality will go up since we will avoid race conditions.
What additional test coverage or changes to tests will be needed? There should probably be new unit tests to cover the additional endpoints.
Will it require cross-browser testing? No.
What does success look like, and how can we measure that?
Success is a more robust way to handle labels on an issue, without race conditions.
What is the type of buyer?
Anyone consuming the API.