cancel
Showing results for 
Search instead for 
Did you mean: 

Delete Object in Alfresco 5.1

sorrentinov
Champ in-the-making
Champ in-the-making
Hi All,

I need to delete a node object as well as a forum post in Alfresco 5.1 but I don't see more the repo webscript

In Alfresco 4.0.e I had the possibility to invoke the REST API:

DELETE /alfresco/service/api/node/{store_type}/{store_id}/{id} (see screenshot)

I try to create a new repo webscript using cmisServer root object but receive an error "cmisServer is not defined"

Is there an alternative way to do the same thing in Alfresco 5.1?

Regards
Vincenzo

5 REPLIES 5

jpotts
World-Class Innovator
World-Class Innovator
Given a file in the root of your repo called deleteme.txt, you can do:

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/deleteme.txt?cmis...

To delete the file.

If you want to get the object instead, you could do:

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/deleteme.txt?cmis...

This is consistent with the CMIS API using the raw browser binding, so read more on that if you need help.

Jeff

sorrentinov
Champ in-the-making
Champ in-the-making
Thanks Jeff for your suggestion to delete a file using CMIS API,

However I need to delete a node (forum post object) using it's noderef (Eg. workspace://SpaceStore/xxxxxxxx…..), is it possible using the CMIS API with browser binding?

Moreover, if I create a repo webscript to do this work, is there a cmis root object in javascript to delete a post node (I see that cmiserver root object is missing in Alfresco 5.1)?

Thx
Vincenzo

jpotts
World-Class Innovator
World-Class Innovator
Yes, you should be able to using the CMIS 1.1 endpoint because CMIS 1.1 supports cmis:item and I *think* that forum objects should descend from cmis:item.

But if you are in a repo webscript there is no reason to use CMIS to do this. Just use the ScriptNode object and call the remove method on that.

http://docs.alfresco.com/community/references/API-JS-remove.html

Jeff

ewhipp
Champ in-the-making
Champ in-the-making

Hey Jeff,

Is this method still available in 5.2? When a do something like 

a href="http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/sites/test-site/documentLibrary/index.html?cmisaction=delete">

It simply downloads the file instead of deleting. Do these delete requests always need to be in a form so that we are not "GET" requesting and always "POST"ing. I'm sure this is a stupid question so I apologize, but I figured I'd reach out because someone else may be having this problem as well.

jpotts
World-Class Innovator
World-Class Innovator

Yes, 5.2 still supports CMIS 1.1 and the browser binding. However, I'm seeing the same thing as you are when I do a GET.

I used cmislib to verify that the browser binding being used here still is able to delete objects. The way that works is that it does a POST against the root URL (http://alfresco.local:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/root) with the content-type set to "application/x-www-form-urlencoded" and the objectId and cmisaction as parameters.

So, if you really need that to be a link, use JQuery or similar to do a POST and it should work.