cancel
Showing results for 
Search instead for 
Did you mean: 

Delete folder with REST+Javascript

luca_de_michele
Champ in-the-making
Champ in-the-making
Hi to All!
I'm trying to realize these three steps:

<strong>1) create a user for example "TOM"</strong> (done succesfully as shown here):


$.ajax({
    type : 'POST',
    async : false,
    url : "/alfresco/service/api/people",
    data : JSON.stringify({
        "userName": "TOM",
        "firstName": "testfirst",
        "lastName": "testlast",
        "email": "m1350@t.it",
        "password": "password",
        "disableAccount": false,
        "quota": -1,
        "groups": ""
    }),
    dataType : 'json',
    contentType : 'application/json',
    success : function(response) {
        alert(response);
    },
    error : function(response) {
        alert(response);
    }
});


<strong>2) delete a user, like "TOM"</strong> (done succesfully as shown here):


$.ajax({
    type : 'DELETE',
    async : false,
    url : "/alfresco/service/api/people/TOM",
    dataType : 'json',
    contentType : 'application/json',
    success : function(response) {
        alert(response);
    },
    error : function(response) {
        alert(response);
    }
});


<strong>3) now i would like to delete also the "TOM" directory from repository</strong> (how can I do it??? can someone show it to me???):


(how can I do it??? can someone show it to me???)







thaks!!!
6 REPLIES 6

mitpatoliya
Star Collaborator
Star Collaborator
you can use api for deleting folder and then have similar call.

http://localhost:8080/alfresco/service/api/node/%7Bstore_type%7D/%7Bstore_id%7D/%7Bid%7D/tree?contin...}

http://localhost:8080/alfresco/service/api/path/%7Bstore_type%7D/%7Bstore_id%7D/%7Bnodepath%7D/tree?...}

Deletes the specified folder and all of its child and descendant objects.

Hi mitpatoliya,
I did not find the api you are suggesting, under:
http://localhost:8080/alfresco/service/index/uri/

I'm using Alfresco Community 5

I think he is referring to following.

https://wiki.alfresco.com/wiki/Repository_RESTful_API_Reference

Delete tree (deleteTree) section

Thanks you all for contributing.

Now, I know how to perform in my hypothetical client the steps (1) (2) (3)… but before I can run the third step, I have to determine {store_type},{store_id},{id}

How can I get, with my hypothetical client, those information?

thanks

abarisone
Star Contributor
Star Contributor
Hi,
The {store_type},{store_id},{id} you're seaching for make the NodeRef.
Here you can find info about NodeRefs https://wiki.alfresco.com/wiki/Node_References_and_Store_Protocols
Use the Alfresco Explorer, navigate to the folder you want to delete, select View Details and in the Links section set your mouse on Alfresco Node Reference hyperlink.
At the bottom left of you browser you will see the NodeRef you need.
If you want to do it programmatically I would suggest you to perform a query using as a filteting criteria TOM and type=cm:folder(or the corresponding type if not default).

Regards,
Andrea

billydoe
Champ in-the-making
Champ in-the-making
Normally what I do is go Administration Console>>Node Browser>>workspace://SpacesStore then try lucence query to see all the metadata of the content. Then I get all the necessary node with ids.