다음과 같은 명령을 사용하여 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-이 문서가 전문화되어야하는 콘텐츠 유형
- 주 버전
- 덮어 쓰다
- 썸네일
반환 내용
- nodeRef
반환 상태 : STATUS_OK (200)
웹 스크립트 설명 문서는 다음 옵션을 지정합니다.
_________________________________________ Value ------ Description ___________________________________________ json -------> The default response format user -------> The authentication access required ---> The transaction level any The format style ___________________________________________
추신 : "PUBLIC" 디렉토리 와 "documents" 사이트 가 이미 존재합니다.
이에 대한 한 가지 접근 방식은 개발자 도구가 열린 상태에서 Chrome을 사용하여 공유를 통해 파일을 업로드하는 것입니다. 네트워크-> XHR 탭에서 업로드 요청을 확인한 다음 마우스 오른쪽 버튼을 클릭하고 "cURL로 복사"를 선택할 수 있습니다. 그런 다음 cURL 명령을 붙여넣고 필요에 따라 조정할 수 있습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다