No action when adding label through API

Using the REST API, one can obtain the actions on a board or card through boards/{id}/actions?filter=all and cards/id}/actions?filter=all respectively.

When adding a label to an already existing label through the UI, we can find an action of type updateCard describing this change.
However, when adding the label through the REST API endpoint cards/{id}/idLabels?value={id} does not lead to any action to show up on either of the reading endpoints boards/{id}/actions?filter=all and cards/id}/actions?filter=all respectively.

Why is that? Is this a bug? Is there a way to add a label through the REST API, so that we can also observe it through the REST API?

Hello @Arne

If you refer to the Action Types documentation, it describes which ones are excluded from being returned from the GET lookups via the REST API.

You will see that all actions related to labels are excluded.

Hi @sunnyape,

Thank you for your response. I was aware of the action type addLabelToCard not being returned through the REST API, though I cannot understand why that is the case: Shouldn’t I be able to get those when I explicitly ask for it through filter=addLabelToCard?

But setting that aside, what I aimed this topic at was: When I manually add a label, I get an action with type updateCard, with

		"data": {
			"card": {
				"idLabels": [
					"xyz"
				],
				"id": "abc",
				"name": "Title",
				"idShort": 999,
				"shortLink": "123456"
			},
			"old": {
				"idLabels": []
			},

so, that I can infer that label with id xyz has been added. This is not the case when I add the label through the REST API.

This looks like a bug to me, but I am open to have my mind changed ;-).

OK, I get what you mean now. Yes, you can read the updateCard object in the JSON response to see the action where a label was changed for a card.

I just did a quick test. I created a new card via the GUI. I then used the PUT method via the Update a card endpoint to add two labels to it. I then used the REST API to get the actions on that card and I saw there was an updateCard action and within the data object there were entries related to those labels changing, the same as your example.

I then went back to the GUI, removed both the labels from the card, then used the REST API to get what actions had been recorded. There were two new updateCard actions, each of which showed the corresponding changes for the labels being removed.

So, at first glance, it seemed using the REST API was identical in outcome to using the GUI.

I then tried using the POST method via the Add a label to a card endpoint to add a label to the card using its ID. When I looked at the card via the GUI, I could see the label was there. When I used the REST API to check what labels the card had, it correctly reported the label was there, in the idLabels object. However, when I then got all the actions on the card, there was no new updateCard action to show the label had been added!

I then tried the DEL method via the Remove a label from a card endpoint to delete that label based on its ID. The GUI correctly shows the change, the idLabels object for the card was correctly updated and become null (empty array), but there was no corresponding updateCard action recorded.

Summary :

  1. Changing labels on a card via the POST and DEL endpoints is not recorded as an updateCard action
  2. Changing labels on a card via the PUT method of the Update a Card endpoint is recorded as an updateCard action.

Maybe this isn’t a bug, but intended behaviour (IE, you must use the PUT method if you want the action recorded)? The documentation doesn’t provide enough detail to know for sure. You’d have to test all the POST / DEL endpoints against their PUT cousin to validate that.

1 Like

Hi @sunnyape,

Thanks a lot for digging into this. I think your analysis makes a lot of sense and that it is a bit unfortunate that this is not readily described in the documentation.