我正在尝试使用以下命令将文件上传到 Alfresco WS restful:
C:\Users\user>curl -v -k -X POST --user admin:admin -F filedata=C:/temp/wpapper.pdf -F siteid=documents -F containerid=documentLibrary -F uploaddirectory=PUBLIC -F filename=wpapper.pdf -F contenttype="application/pdf" http://10.1.1.55:8080/alfresco/service/api/upload
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 10.1.1.55...
* Connected to 10.1.1.55 (10.1.1.55) port 8080 (#0)
* Server auth using Basic with user 'admin'
> POST /alfresco/service/api/upload HTTP/1.1
> Host: 10.1.1.55:8080
> Authorization: Basic Z2xvbWFyb246c2VxMDk4
> User-Agent: curl/7.46.0
> Accept: */*
> Content-Length: 715
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------5ee452c8955311dc
>
< HTTP/1.1 100 Continue
< HTTP/1.1 400 Bad Request
< Server: Apache-Coyote/1.1
< Cache-Control: no-cache
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Pragma: no-cache
< Content-Type: application/json;charset=UTF-8
< Content-Length: 362
< Date: Wed, 18 May 2016 14:03:47 GMT
< Connection: close
<
{
"status" :
{
"code" : 400,
"name" : "Bad Request",
"description" : "Request sent by the client was syntactically incorrect."
},
"message" : "Required parameters are missing",
"exception" : "",
"callstack" :
[
],
"server" : "Community v5.1.0 (r122274-b3) schema 9.016",
"time" : "18/05/2016 10:03:47"
}
* Closing connection 0
将文件内容和元数据上传到存储库。
POST /alfresco/service/api/upload
HTML 表单数据
- filedata,(强制)HTML 类型文件
- 您必须指定以下之一:
- 目的地(将在其中创建节点的文件夹 NodeRef)
- updateNodeRef(将要更新的现有节点的 NodeRef)
- siteid 和 containerid(站点名称和该站点中的容器 > 创建文档的位置)。
- uploaddirectory - 将上传文档的文件夹的名称(在站点容器中或目标中)。此文件夹必须已经存在
- description - 版本更新的描述 (versionDescription)
- contenttype - 此文档应专门用于的内容类型
- 主要版本
- 覆盖
- 缩略图
返回内容
- 节点参考
返回状态:STATUS_OK (200)
Web 脚本描述文档指定了以下选项:
_________________________________________ Value ------ Description ___________________________________________ json -------> The default response format user -------> The authentication access required ---> The transaction level any The format style ___________________________________________
PS.:目录“PUBLIC”和站点“documents”已经存在。