Query the REST API for a Tag by slug

I was looking at this before… Here is what I found (about 7 months old from today 3/21/2018.)

The “correct” way to do this with the REST API is to get the IDs of each of those tags, then make the request using the ?tags= parameter: assuming “clicks” has ID 1, and “passes” has ID 2, that would look like this

http://www.example.com/wp-json/wp/v2/posts?tags[]=1&tags[]=2

Using slugs for querying taxonomy terms is an issue, but slug-based queries were deliberately left out of core because they are more prone to change than taxonomy term IDs. To demonstrate the issue, if you renamed a slug and made a request with an outdated slug, your request will fail; but if you use the ID, changing the slug will not break your query.

You can get the ID of a slug by querying for e.g. /wp/v2/tags?slug=clicks

tech