find tag id by label

Anything concerning integration via the REST API
Post Reply
Mise
Posts: 13
Joined: Sun Dec 19, 2021 2:48 pm

find tag id by label

Post by Mise »

How I can get Tag id by label, without full list /v4/tags/ ?
bwakkie
50 Posts
50 Posts
Posts: 70
Joined: Fri Feb 14, 2020 8:28 pm

Re: find tag id by label

Post by bwakkie »

When you edit any tag you will see the id in the URL also when you hover with your mouse over the tag it is displayed

Another option is to filter the API response...

Code: Select all

/api/v4/tags/?_fields_only=id,label
will give you something like:

Code: Select all

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 2,
            "label": "LABEL-A"
        },
        {
            "id": 1,
            "label": "LABEL-Z"
        }
    ]
}
Mise
Posts: 13
Joined: Sun Dec 19, 2021 2:48 pm

Re: find tag id by label

Post by Mise »

thanks a lot.
I've 5000 tags, I hope i can find tag without full enumeration
Post Reply