Create Folder hierarchy using Alfresco REST API only

cancel
Showing results for 
Search instead for 
Did you mean: 
piyush48
Established Member

Create Folder hierarchy using Alfresco REST API only

Hi Everyone,

I have requirement of Creating folder hierarchy using REST API. I am able to create single single folder using following call:- 

http://localhost:8080/alfresco/service/api/site/folder/Test/documentLibrary/Test 1

i want my folder hierarchy as follows:-

Site:- Test Container:- documentLibrary folder hierarchy as :- Test 1/Test 2/Test 3/Test 4.

i am able to acheive it by running it again and again but want it in one go.

Also like i am able to create folders using content create API by providing relative path by using below call:-

http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children


relativepath as:- test/documentLibrary/test1/test2/test3/test4
also by providing filedata and nodetype. 
but i want only folder hierarchy without content.

 

can i create folder hierarchy anyway by using relative path?

Please do guide me out on this.

Thanks and Regards,

Piyush.

4 Replies
afaust
Master

Re: Create Folder hierarchy using Alfresco REST API only

There is no way to create a hierarchy in just one call. You have to call it multiple times.

piyush48
Established Member

Re: Create Folder hierarchy using Alfresco REST API only

Hi @afaust ,

Is there anyway such task can be acheive through CMIS API call?.

Any other way possible for this without using Alfresco API services ? cause i am creating standalone java application for it.

Thanks,

Piyush.

afaust
Master

Re: Create Folder hierarchy using Alfresco REST API only

No - AFAIK there are no standard APIs that you can use to create an entire path in one call. You would have to create a custom web script / action for that. The latter could be triggered via Alfresco ReST API as far as I know (I have never done / tried that myself).

plarochette
Customer

Re: Create Folder hierarchy using Alfresco REST API only

Hi,

If I understand correctly the question, i think it is now possible.

The Api explorer doc says  :

"The relativePath specifies the folder structure to create relative to the node nodeId. Folders in the
relativePath that do not exist are created before the node is created."

I have tried this and the folders are all well created in one call....

Best regards