I'm trying to move a document from location A to location B and would like to:
- Keep the categories that are already assigned to the document.
- Inherit any additional categories from the destination folder.
According to the REST API documentation for PUT /nodes/v2/{id}, category inheritance can be controlled through the roles.categories.inheritance setting.
Examples from the documentation:
Original categories inheritance
{
"parent_id": 5678,
"roles": {
"categories": {
"inheritance": 0
}
}
}
Destination categories inheritance
{
"parent_id": 5678,
"roles": {
"categories": {
"inheritance": 1,
"6228_2": "hello"
}
}
}
Merged categories inheritance
{
"parent_id": 5678,
"roles": {
"categories": {
"inheritance": 2,
"9830_1": {},
"6228_1": {}
}
}
}
What is unclear to me is whether setting "inheritance": 2 alone should be sufficient to merge the document's existing categories with those inherited from the destination folder.
I expected the following payload to preserve the current categories and add any categories inherited from the target location:
{
"parent_id": 5678,
"roles": {
"categories": {
"inheritance": 2
}
}
}
However, when I use this payload, the document is moved without any categories assigned.
My question is: Should the payload above work as-is, or is it required to explicitly provide all existing category values from the source document plus all category IDs/values that should be inherited from the destination location?
The latter seems somewhat counterintuitive, so I'm wondering if I'm misunderstanding how category inheritance is intended to work during a move operation.