As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Please share Rest api code for creating folder and sub folders using java?
Example:
Education
SSC
Professional
Kyc
Here education is parent folder and remaining three are subfolders .I need code please share ASAP.
Regards
Rajeev
AFAIK, It is not possible to create the folders and subfolders in one go via any rest apis. However, please the below rest api which can be used to create folders:
https://docs.alfresco.com/content-services/5.2/develop/rest-api-guide/folders-files/#create-a-folder
http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/{id}/children
The id can be either one of the constants -root-, -shared-, -my- or an Alfresco Node Identifier (e.g. 444be4a6-5693-4d10-af4b-b55448fe4f97). The POST data defines the folder metadata and looks like in this example:
id
-root-
-shared-
-my-
{ "name": "My Folder", "nodeType": "cm:folder", "properties": { "cm:title": "My Folder", "cm:description": "My new folder" } }
If you would have to create the folder and subfolders in one go, you would have to create your custom webscript to handle your specific requirement. In your webscript you can include the code to create folders/subfolders based on the path value passed.
See the detailed solution here: https://hub.alfresco.com/t5/alfresco-content-services-forum/how-to-create-directory-structure-using-java-api/m-p/303068/highlight/true#M21989