cancel
Showing results for 
Search instead for 
Did you mean: 

change cm:content to a subtype in a document by rest api

carloslo
Champ in-the-making
Champ in-the-making
Hello,
im trying to change the content type of a document by api res. I need change the content type to a custom model when upload a new file or to a file uploaded previusly.

My model is:
<type name="cm:content">
   <subtype name="RCP:crop"/>
</type>

when I send a request to localhost:8080/alfresco/service/api/metadata?nodeRef=workspace://SpacesStore/{id}
with the id of a document of type rcp:crop y retrieve:
{
    "mimetype": "image/png",
    "aspects": [
        …    ],
    "nodeRef": "workspace://SpacesStore/564e0dce-e0e6-46ec-9367-795943546130",
    "properties": {
        …    },
    "type": "{http://www.alfresco.org/model/RCP/1.0}crop"
}

but if i try to change the type to another document (type cm:content) like any other metadata with a request to localhost:8080/alfresco/service/api/metadata/node/workspace/SpacesStore/{id} with body:
{
"type":"{http://www.alfresco.org/model/RCP/1.0}crop"
}

the response it's success but nothing change.

Anyone knows how i can change the content type to the subtype RCP:crop?

Thanks
1 REPLY 1

s_palyukh
Star Contributor
Star Contributor
Hi,

To change type of the document you need to send POST request by the following url "/alfresco/s/slingshot/doclib/type/node/workspace/SpacesStore/{id}" with body :


{
"type":"rcp:crop"
}