Newly created vocabulary doesn't work with REST API but old vocabulary works

By xngo on March 13, 2021

Issue

I have a REST API function that takes a vocabulary machine name as input and create a term for that vocabulary. This function is working fine with existing vocabulary but not with newly created vocabulary. It returns the following error message:

{
"message": "Type https://example.com/rest/type/taxonomy_term/fruit does not correspond to an entity on this site."
}

Solution

After spending more than 2 hours on this, I found that my REST API function is working fine and my JSON syntax is correct too. The issue is the newly created vocabulary is not effective until I clear the cache. That is why the message says that it can't find the corresponding entity on my site.

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.