PATCH Object Request Fails With Mandatory Vocabulary
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
legacy-article
learn-legacy-article-disclaimer-text
Issue
- When trying to perform a PATCH request on an object instance to update a field, if the object has a required vocabulary, the request fails with the following error:
{
"detail": "Select at least one taxonomy category for vocabulary <vocabulary_name>",
"status": "BAD_REQUEST",
"title": "Select at least one taxonomy category for vocabulary <vocabulary_name>",
"type": "AssetCategoryException"
}
- Even including the mandatory category with the taxonomyCategoryBriefs field, the same error is returned.
Resolution
- To associate the mandatory vocabulary to the object during the PATCH request, use the taxonomyCategoryIds field, like this:
{
"id": <object_id>,
"taxonomyCategoryIds": [<category_id>],
"<field_name>": "<field_value>"
}
did-this-article-resolve-your-issue