I’m trying to post a document to Content Server, using REST API, to folders that have categories with required attributes on them.
We are currently on CS10 Update 2015-12, Service Pack 2, but I couldn’t find any specific documentation indicating how to populate the structure of the Categories with the required attributes when uploading a document; e.g. roles: {categories: categories}.
Included below is the code I use to upload documents using POST /nodes, but this only works on containers without the required category attributes applied.
function upload(files,i){
formData = new FormData();
formData.append( "type", 144 );
formData.append( "parent_id", 19051);
formData.append( "name", files[i].name );
formData.append( "file", files[i]);
if (typeof files[i] === 'undefined') { return false; }
$.ajax({
type:'POST',
url: "…/api/v1/nodes",
data: formData,
contentType: false,
processData: false,
headers: { otcsticket: otcsticket },
dataType:'json',
}).done(function(){
console.log(‘Success’);
}).fail(function(){
console.log("failed, message:");
});
};
Any help with this would be much appreciated.