I am trying to use alfresco. I want to use PHP restfull APIs.
Followings are my task.
1) Listing of all directory and documents.
2) Upload a file and create or add properties/metadata for the file.
3) Checkout and checkin a file.
4) Retrieve a specific version of a file.
5) Create and edit tag.
I got list of APIs from.
http://localhost:8080/alfresco/service/index/uri/
and
http://wiki.alfresco.com/wiki/2.1_REST_API
Some of them is working and some of them is not working. Can anyone provide me the restfull PHP APIs for above tasks.
Even I am getting internal server error. Below is the code to add/create a tag.
<form
action="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/b0697dd1-
ae94-4bf6-81c8-5e2fa098ddfa/tags" method="post">
<input type="text" name="name" value='["t222a","t222b","t222c"]' />
<input type="text" name="tags" value='["t222a","t222b","t222c"]' />
<input type="submit" />
</form>
Can anyone help me to figure it out?
Also there is no such help how I use custom data using API call.
Thanks in Advance
Your use case sounds like a typically usecase for CMIS. Take a look at the Apache Chemistry CMIS PHP Client
If you want to use Alfresco's REST API Assuming that you're using Alfresco 4.2 then take a looks at the offical REST API docs.
as most REST APIs most of Alfresco's Webscripts expects a json payload and not a FormData. The following curl is an example to add a tag (basis auth with admin/admin):
curl "http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/4c3aa00e-2aee-440e-aab5-0bb0570d8b01/tags" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46YWRtaW4=" --data-binary "[""tag1"", ""tag2""]"
If you want to POST this via browser the you'll have to build the XHR-request on your own, e.g. by using jquery:
<html>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$.ajax({
type: "POST",
url: "http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/4c3aa00e-2aee-440e-aab5-0bb0570d8b01/tags",
data: JSON.stringify(["tag3", "tag4"]),
success: function() {},
dataType: "json",
contentType: "application/json"
});
</script>
</body>