Creation of tag is not working properly

  • 19 July 2022
  • 8 replies
  • 92 views

Badge +1

Hi!!!

 

When trying to create a new tag, response always tells the tag already exists but it’s not correct.

No matter wich title you specify, the response is always the same.

 

Any idea of what is wrong?!

 

Thanks!!!

 

curl --request POST \
     --url https://api.miro.com/v2/boards/<a valid board id>/tags \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer <a valid access token>' \
     --header 'Content-Type: application/json' \
     --data '
{
     "fillColor": "red",
     "title": "levelCode"
}

 

Response:

{
  "type": "error",
  "code": "6.0303",
  "context": {
    "boardId": "<a valid board id>"
  },
  "message": "Tag with title levelCode already exists",
  "status": 400
}


8 replies

Userlevel 2
Badge +1

Hello Boyan, 

Sorry to know that you are facing issues with Tags. I just tested this and I could create a tag on a new board I created both via the REST API v2 using the Try It Out feature in the documentation here: https://developers.miro.com/reference/create-tag. I could also attach a tag to a sticky note or a card (supported items for tags at the moment). I also had no problem getting the tags attached to an item, which in this case, is a sticky note. I’ve provided the sample request and the response for each endpoint later in my reply. 

Can you please provide more information about the problem you are facing with tags? It would also be great if you can provide a sample request and the response that you get so we can help troubleshoot better.

Create Tag
Here’s my request I used:
curl --request POST \
     --url https://api.miro.com/v2/boards/<board_id>/tags \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <access_token>' \
     --header 'content-type: application/json' \
     --data '
{
     "fillColor": "red",
     "title": "to do"
}
'  

Here’s the response I got:
{
  "id": "3458764541654614172",
  "type": "tag",
  "title": "to do",
  "links": {
    "self": "https://api.miro.com/v2/boards/<board_id>/tags/3458764541654614172"
  },
  "fillColor": "red"
}

Atta​​​​​ch Tag to Item (Sticky Note)

Here’s the request:
curl --request POST \
     --url 'https://api.miro.com/v2/boards/<board_id>/items/<sticky_note_id>?tag_id=3458764541654614172' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <access_token>'

Here’s the response I got:

204 - No content

Get tags from Item (Sticky Note)

Here’s the request:
curl --request GET \
     --url https://api.miro.com/v2/boards/<board_id>/items/<sticky_note_id>/tags \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <access_token>'

Here’s the response I got:

{
  "tags": [
    {
      "id": "3458764541654614172",
      "type": "tag",
      "title": "to do",
      "links": {
        "self": "https://api.miro.com/v2/boards/uXjVP4I8Wj8=/tags/3458764541654614172"
      },
      "fillColor": "red"
    }
  ]
}

 

Looking forward to hearing back from you. Thanks and have a good one. 

 

Your friendly developer advocate, 

Mira
 

Badge

Same issue at the end of December, 2022.

Badge

I also had issues fetching all tags for the board, exactly as illustrated in the previous post.


In my case, I’hadn’t installed my app into the auto-created Development Team, where my board was. Once I did that, and switched credentials accordingly, all was well again.

Badge +1

More samples @Joanna Smith …

You can see at the left side the Miro board with a card containing a tag “pepe”. At the right side, the result of invoking get all tags returns an empty array for that board.

 

 

Badge +1

@Joanna Smith by the way…

  • I’m trying to read, create and attach tags.
  • I’ve created a tag manually on the board but it cannot be read with the “get all tags” API. Also that tag is not returned invoking the get tag from item.
  • When I run “get all”, an empty array is returned in the data field.

 

Thanks!

Badge +1

Hi Joanna!!!

You can test it with your developer web page:

 

Userlevel 2
Badge

Also -- one thing I just thought of based on our last conversation: if you’re using `levelCode` as a variable, make sure it isn’t in quotes when you make your data object.

 

--data '
{
"fillColor": "red",
"title": levelCode
}
'

 

Userlevel 2
Badge

Hey @Pepe Cáceres -- I’m sorry to see you’re still struggling with this Tags issue. Last time we spoke, I was having trouble reproducing this bug, so I started from scratch today, and I still can’t seem to encounter the same error.

 

So I have a few suggestions:

First, let’s check the basics: you’re trying to create a tag, correct? Note that creating and attaching tags are two different steps. If a tag already exists anywhere else on the board, then it can be attached to an item. It does not need to be created again. Creating a tag simply populates the name and color into the board’s list of available tags. Attaching and removing tags are how we “add” a tag to a specific item.

Second, let’s check what the board believes the tags are. Can you run a call to get all of the Tags from the board, and let me know if the “levelCode” tag appears in that list?

Finally, let’s see if this is an error related to a specific board. Have you tried making tags on a different board? Have you tried creating the tag from the developer documentation? (If you paste your access token and your board ID into the fields, you can run the curl command directly from the docs.)

 

Again, I’m sorry this is still such a headache for you. Hopefully we can get it sorted out quickly.

-Joanna

Reply