cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting a Node

dallinns
Champ on-the-rise
Champ on-the-rise
I have found no (documented) way that you can delete a node using the PHP library. However, my intuition tells me that the absence of such a basic function would be bizarre.

Does anyone know how to delete a node (or document, or file, or whatever) in PHP?
4 REPLIES 4

ddanninger
Champ in-the-making
Champ in-the-making
Well , removeChild isnt implemented in the Alfresco Library right now, i would suggest you to do it via REST – Alfresco Share uses the WebScript:

http://localhost:8080/alfresco/service/slingshot/doclib/action/file/node/{$nodeRef}

nodeRef should be like = "workspace/SpacesStore/XXXXXXXXXXX"

Just send a "DELETE" Method on the HTTP Request to this URL and it should be fine.

If you have now Idea how to speak to a REST Webservice in PHP , there are many good tutorials out there …. for example -> http://www.sematopia.com/2006/10/how-to-making-a-php-rest-client-to-call-rest-resources/

its an good implementation of the RESTClient Class, which can be really useful

dallinns
Champ on-the-rise
Champ on-the-rise
Is there a list of all the services/web scripts (or whatever) that are used by Alfresco Share?

ddanninger
Champ in-the-making
Champ in-the-making
Is there a list of all the services/web scripts (or whatever) that are used by Alfresco Share?

i released my extended PHP Library …. you can try this one … in my library i implemented a few RESTFul Scripts….

Download here: http://forge.alfresco.com/projects/ifresco-phplib/

with my library it must work like:


<?php
  $repositoryUrl = "http://localhost:8080/alfresco/api";
  $userName = "admin";
  $password = "admin";

$repository = new Repository($repositoryUrl);
    $ticket = $repository->authenticate($userName, $password);
    $session = $repository->createSession($ticket);
    $spacesStore = new SpacesStore($session);

$nodeId = "0000-0000-00000-0000";

    $RESTContent = new RESTContent($repository, $spacesStore, $session);
echo "<pre>";
print_r($RESTContent->DeleteNode($nodeId));
?>

Code is untested, hopefully it works.


For a list of all services http://localhost:8080/alfresco/service/index …. if you navigate to "browse all packages" here you will see many webscripts where "/slingshot/" is in the URL. These ones are used by Share.

ligiahag7902
Champ in-the-making
Champ in-the-making
Well , removeChild isnt implemented in the Alfresco Library right now, i would suggest you to do it via REST – Alfresco Share uses the WebScript:

http://localhost:8080/alfresco/service/slingshot/doclib/action/file/node/{$nodeRef}

nodeRef should be like = "workspace/SpacesStore/XXXXXXXXXXX"

Just send a "DELETE" Method on the HTTP Request to this URL and it should be fine.

If you have now Idea how to speak to a REST Webservice in PHP , there are many good tutorials out there …. for example -> http://www.sematopia.com/2006/10/how-to-making-a-php-rest-client-to-call-rest-resources/

its an good implementation of the RESTClient Class, which can be really useful

Such a very amazing link!