
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2020 11:41 AM
Hi,
is there any API service that i can call to change nodeType of a document.
Thanks for reading, hope someone has the answer!
- Labels:
-
Alfresco Content Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2020 12:54 PM
There is an action to change the type OOTB in share:
https://docs.alfresco.com/6.0/tasks/library-item-change-type.html
It calls a repository webscript: Document List Component - type submit at "/slingshot/doclib/type/node/{store_type}/{store_id}/{id}" url.
If you want to change the type via rest call, you can utilize above given webscript. This webscript can change the type from cm:content to custom content type you have created.
e.g.:
<type name="cm:content"> <!-- Custom sub-type added for whitepapers --> <subtype name="my:whitepaper" /> </type>
but if you want to change the type between two custom content types then it will not work. You can customize the above webscript to handle this case.
e.g.:
<type name="my:whitepapper"> <subtype name="my:relatedwhitepaper" /> </type>
Here is the webscript definition:
type.post.desc.xml
<webscript> <shortname>type</shortname> <description>Document List Component - type submit</description> <url>/slingshot/doclib/type/node/{store_type}/{store_id}/{id}</url> <format default="json">argument</format> <authentication>user</authentication> <transaction>required</transaction> <lifecycle>internal</lifecycle> </webscript>
In custom webscript, you can get the targetType and build the nodeRef based on "store_type, store_id and Id" and use NodeService to set the type. All the required input will be available in json payload sent to the webscript on change Type action.
You can find an example here: https://javaworld-abhinav.blogspot.com/2020/06/change-type-of-custom-content-types.html
(ACSCE, AWS SAA, Azure Admin)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2020 12:54 PM
There is an action to change the type OOTB in share:
https://docs.alfresco.com/6.0/tasks/library-item-change-type.html
It calls a repository webscript: Document List Component - type submit at "/slingshot/doclib/type/node/{store_type}/{store_id}/{id}" url.
If you want to change the type via rest call, you can utilize above given webscript. This webscript can change the type from cm:content to custom content type you have created.
e.g.:
<type name="cm:content"> <!-- Custom sub-type added for whitepapers --> <subtype name="my:whitepaper" /> </type>
but if you want to change the type between two custom content types then it will not work. You can customize the above webscript to handle this case.
e.g.:
<type name="my:whitepapper"> <subtype name="my:relatedwhitepaper" /> </type>
Here is the webscript definition:
type.post.desc.xml
<webscript> <shortname>type</shortname> <description>Document List Component - type submit</description> <url>/slingshot/doclib/type/node/{store_type}/{store_id}/{id}</url> <format default="json">argument</format> <authentication>user</authentication> <transaction>required</transaction> <lifecycle>internal</lifecycle> </webscript>
In custom webscript, you can get the targetType and build the nodeRef based on "store_type, store_id and Id" and use NodeService to set the type. All the required input will be available in json payload sent to the webscript on change Type action.
You can find an example here: https://javaworld-abhinav.blogspot.com/2020/06/change-type-of-custom-content-types.html
(ACSCE, AWS SAA, Azure Admin)
