0

I have an ESB webservice client which upload document to Alfresco using following RestAPI .

http://:8080/alfresco/service/api/upload

I understand , API to be called as multipart / form data , with file and mandatory fields . When i executed , i got the following error ersponse back .

{
  "status": {
    "code": 400,
    "name": "Bad Request",
    "description": "Request sent by the client was syntactically incorrect."
  },
  "message": "Required parameters are missing",
  "exception": "",
  "callstack": [],
  "server": "Enterprise v5.2.3 (r852994b1-b12) schema 10,065",
  "time": "10-Jul-2020 12:26:47"
}

I use WSO2 ESB client , ESB code looks all good . The only place where i can debug is through wirelog . wirelog shows alll good( please scee screen shot below) . Error message has confilicting information like

"description": "Request sent by the client was syntactically incorrect." "message": "Required parameters are missing",

Is there a log i can get from Alfresco server side to identify what actually is the issue , which syntax is incorrect ? what parameter is missing ?

Screen shot for wire log as below

please click this link to see image of wiretap

Nand_Dev
  • 13
  • 3

2 Answers2

0

Which documentation are you following? By having a quick look here, I'd say you're not sending everything you should be: https://docs.alfresco.com/5.0/references/RESTful-UploadUploadPost.html

This is the condition you're seeing getting triggered, so I'd look more closely in what you're actually sending. Maybe use Fiddler or some similar software to record your request and inspect it.

// Ensure mandatory file attributes have been located. Need either destination, or site + container or updateNodeRef
      if ((filename === null || content === null) || (destination === null && (siteId === null || containerId === null) && updateNodeRef === null))
      {
         exitUpload(400, "Required parameters are missing");
         return;
      }

Also, the web script in question can be found here, it's implemented in JS so it would be relatively easy to add additional (temporary) logging.

...alfresco\tomcat\webapps\alfresco\WEB-INF\lib\alfresco-remote-api-5.0.d.jar\alfresco\templates\webscripts\org\alfresco\repository\upload\
Lista
  • 2,096
  • 1
  • 14
  • 18
  • As I mentioned, I am sending all the parameter which are required. Same parameter works fine from other Rest client. Is there a way to get logs for rest service? Or payload I am passing so that I will know which one is missing. – Nand_Dev Jul 11 '20 at 18:06
  • Have a look at the updated answer, maybe it will be of help. Good luck! :) – Lista Jul 13 '20 at 12:40
  • Hi thanks , your comments helped me to know what fields are coming through & whats not etc . But is there a way to know raw HTTP request recieved by Alfresco using any of log configuration ? – Nand_Dev Jul 13 '20 at 19:31
  • You could setup Tomcat access log to log parameters and body too, but this does not work out of the box. – Lista Jul 14 '20 at 07:24
0

You can use api-explorer rest api to upload document.

https://api-explorer.alfresco.com/api-explorer/#!/nodes/createNode

Sanjay
  • 2,265
  • 1
  • 11
  • 26