AnsweredAssumed Answered

Help on REST API to upload new document to folder

Question asked by billwyuan on Nov 12, 2017
Latest reply on Nov 14, 2017 by marktielemans

Upload a text document to a folder in Alfresco seems not working using Rest API. I have a site named R02, under documentLibrary has a folder bank1. I am using Postman rest client tool.

POST: http://76eiss.trial.alfresco.com/alfresco/service/api/upload?alf_ticket=TICKET_a314df3eb2e0ac986b26e0b365d58a2793528e7b

Header: Authorization: [{"key":"Authorization","value":"Basic YmlsbHd5dWFuQHlhaG9vLmNvbToxMjM0eXVhbg==","description":""}] 

Request body

{
"filedata":"any text",
"filename": "test1.txt"
"description": "example"
"siteid":"r02",
"containerid":"documentlibrary" ,
'uploaddirectory': 'bank1'

also tried:

{
"filedata": "textxxxxxl",
"filename": "test1.txt",
"description": "example",
"siteid": "r02",
"containerid": "508440fc-1578-45a5-b4f7-87eb5ea6f40a"

}

and 

{
"filedata": "@test.txt",
"filename": "abc.text",
"siteid": "r02",
"containerid": "workspace:\/\/SpacesStore\/99c6f662-242f-4917-85bb-ae5a9b8454e8"

 

}

 

In response, it always return 502 bad gateway. I also tried a community edition 5.0.d. Not success.  Does anyone see the problem I have?

 

thank you very much!

Bill

Outcomes