dongxia2030 2014-06-16 04:58
浏览 47
已采纳

Alfresco ::很少有PHP API可用

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

  • 写回答

1条回答 默认 最新

  • dpy83214 2014-06-16 09:34
    关注

    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>
    

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度