cancel
Showing results for 
Search instead for 
Did you mean: 

Strange WS to delete archived node

sammasue
Champ in-the-making
Champ in-the-making
Hello,

According to this documentation http://docs.alfresco.com/5.0/references/RESTful-ArchiveArchivednodesDelete.html the following webscript call should delete the node from the archive (purge). However I can use it against node which are not archived. I can actually use it as a webscript to simply delete nodes.

<blockcode>
curl -uadmin:admin -X "DELETE" http://localhost:8080/alfresco/s/api/archive/workspace/SpacesStore/1fc9bb4e-d587-4260-8a12-3b5c14a94...
</blockcode>

I find it really strange, does anybody have any thought on it? Do you think I can use it to delete nodes? Maybe not recommended?

To delete node should I use instead (or should I create one, which is not really complex?):
<blockcode>
curl -uadmin:admin -X "DELETE" http://localhost:8080/alfresco/s/slingshot/doclib/action/file/node/workspace/SpacesStore/1bc448ca-e4...
</blockcode>
Thanks,
Sam
4 REPLIES 4

sujaypillai
Confirmed Champ
Confirmed Champ
The service endpoint is defined as -
DELETE /alfresco/service/api/archive/{store_type}/{store_id}/{id}


So when trying to deleting from archive space  your {store_type} would be archive, {store_id} would be SpacesStore and {id} would be node_id to be deleted

Eg. to delete a node in archive space with node id 8fd584b9-3148-4b13-92ab-70d70f3c584b the curl command would be -
curl -u admin:admin -X "DELETE" http://localhost:8080/alfresco/service/api/archive/archive/SpacesStore/8fd584b9-3148-4b13-92ab-70d70...


which would give a response as below:
<blockcode>
{
   "data":
   {
      "purgedNodes":
      [
         {
            "nodeRef": "Node no longer exists: archive://SpacesStore/8fd584b9-3148-4b13-92ab-70d70f3c584b"
         }
      ]
   }
}
</blockcode>

sammasue
Champ in-the-making
Champ in-the-making
Well I have not tried this, however I was looking more for an "out of the box" webscript to delete nodes (un-archived nodes). And I found strange that this one (alfresco/service/api/archive) was able to do the job. It's actually moves nodes from workspace to archive.

marsbard
Champ in-the-making
Champ in-the-making
You set the store type to 'archive'. So it attempts to delete from the archive://SpacesStore

To delete from the active workspace you can use 'workspace' instead.

"/alfresco/s/api/archive/workspace/SpacesStore/" + nodeId

prusik666
Champ in-the-making
Champ in-the-making

Hello,

I have taken the time to test and debug these since we need to implement a purging mechanic at the company where I work. I'm pretty sure this is meant to be an archive purge service, but can also currently be used to delete a single workspace node. I have included the GET statement since you might need it to read archives before deleting.

Here is the official documentation.

GET archived (deleted) items | Alfresco Documentation 

DELETE permanently (purge) a node or nodes from the archive | Alfresco Documentation 

There is one caveat to watch out for in this service. For both the GET and DELETE options, you need to specify "workspace" as the store_id when fetching and deleting multiple node, however you must specify "archive" when deleting a single node. In other words, when you specify the noderef, you must use the archive store_id, but when you don't specify a noderef, you must specify the original store_id where the undeleted document was stored. In this case, the code has a map function that obtains the archive store from the workspace store, which is not called when the noderef is specified. This is very misleading and was probably not the original intent, but I don't see them fixing this issue without deprecating this service.

GET:

Obtain one page of deleted documents (store_id = workspace).

/alfresco/service/api/archive/{store_type}/{store_id}?maxItems={maxItems?}&skipCount={skipCount?}

For example, to fetech the first page of 100 documents:

/alfresco/service/api/archive/workspace/SpacesStore?maxItems=100&skipCount=0


DELETE

Purge one page of archived (deleted) documents (one page by default is 1000 - store_id = workspace😞

/alfresco/service/api/archive/{store_type}/{store_id}
For example,

/alfresco/service/api/archive/workspace/SpacesStore


Purge one archived (deleted) document (store_id = archive):

/alfresco/service/api/archive/{store_type}/{store_id}/{id}
For example, to delete node cb59255e-d58f-4691-a299-65326a426e73:

/alfresco/service/api/archive/archive/SpacesStore/cb59255e-d58f-4691-a299-65326a426e73

Hoping this helps someone out!

shaun