cancel
Showing results for 
Search instead for 
Did you mean: 

Upload REST API shows 400 bad request

brijeshnk
Star Contributor
Star Contributor

Hi there ,

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

http://<xxx>: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
 
image
 
 
 
 
6 REPLIES 6

malekgn
Confirmed Champ
Confirmed Champ

Did you verify that your alfresco version supports the above webservice ?

Hi ,

Yes  i can call the same API from other clients  . POSTMAN and SOAPUI  client works and gives success message. 

When i called using WSO2( ESB)  client its rejecting  with error messages mentioned above .  for  debugging ,  I captured  wirelog using wireshack  ( attached in original message above) ,  I dont see anything  anwrong in that too . Hence i suspect something wrong  in server .    Where exactly i can see incoming API messages or more debugging logs for Rest API service

EddieMay
World-Class Innovator
World-Class Innovator

Hi @brijeshnk,

As @malekgn says, check the supported API version - take a look at this thread for a similar issue.  

HTH

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!

abhinavmishra14
World-Class Innovator
World-Class Innovator

if i understand correctly, you are sending upload requesy to a SOAP webservice and from within the webservice you are calling alfresco file-upload rest api. 

Did you checked the webervice code whether it is able to get the input stream from the request for further passing it to alfresco file-upload rest api? Did you tried setting MTOM property to true while sending your soap request with filedata?

I remember this is one of the requirement for passing binary data to soap webservice. An example of enabling MTOM can be seen here for soapui client, likewise your client may have option to enable mtom. May be give it a try.

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

warrensacko
Champ in-the-making
Champ in-the-making

Returning 400 means that the request was malformed. In other words, the data stream sent by the client to the server didn't follow the rules. The client SHOULD NOT repeat the request without modifications. It means that the request itself has somehow incorrect or corrupted and the server couldn't understand it. The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method . Therefore, it prevents the website from being properly displayed. To fix a 400 Bad Request error, it is best to start diagnosing the issue from the client side itself. Complete the steps outlined in this section to help diagnose and correct the error.

  • Check for errors in the URL.
  • Clear Browser Cache and cookies.
  • Clear DNS Cache.
  • Check your File upload Size.
  • Deactivate Browser Extensions.
  • Contact the site owner to report the 404 error.

McEvoy1
Champ in-the-making
Champ in-the-making

Thanks for the step by step tutorial. Works like a charm!