Forum Discussion

bik's avatar
bik
Occasional Contributor
7 years ago

Trying to send a attachment in POST request

Below is the Curl .

curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' {"type":"formData"} 'http://domain/users/users/import'

 

 

 

 

While doing this am getting a 400 Bad Request.

 

The request body is as below but all are optional parameter.

{

  "user": "string",

  "Time": "2018-06-25T09:50:43.461Z",

  "Data": "string",

  "FileName": "string",

  "Status": "string",

  "TotalUsers": 0,

  "UnassignUsers": 0,

  "UniqueUsers": 0,

  "UpdatedUsers": 0,

  "UserLogId": 0

}

 

 

After selecting the Media-Type as multipart/form-data ,attaching xml file and hitting post in SoapUI.

 

  • bik's avatar
    bik
    7 years ago

    The problem is solved now.

    The file will be provided as parameter in SoapuI and then a path of the file.

     

    and then attach the file and hit on POST.

  • Lucian's avatar
    Lucian
    Community Hero

    Is there anything more in the response? An error message maybe? Don't you have access to the application's logs? I guess there are many problems that can be signaled by the 400 status response...

  • bik's avatar
    bik
    Occasional Contributor

    HTTP/1.1 400 Bad Request

    Date: Mon, 25 Jun 2018 11:17:55 GMT

    Server: Apache

    Cache-Control: no-cache, no-store, max-age=0, must-revalidate

    Pragma: no-cache

    Expires: 0

    X-XSS-Protection: 1; mode=block

    X-Frame-Options: DENY

    X-Content-Type-Options: nosniff

    Set-Cookie: JSESSIONID=-BFD1zwe2dw5rQvpPwfFqcjf.hfs-support-service_test_0; Path=/domain

    X-Application-Context: application

    Connection: close

    Transfer-Encoding: chunked

    • Lucian's avatar
      Lucian
      Community Hero

      Can't put my finger on it. Again, there can be multiple causes for this. Can't you access the application's logs?

      • TanyaYatskovska's avatar
        TanyaYatskovska
        SmartBear Alumni (Retired)

        Hi Community,

         

        Is there anybody who faced a similar issue? Could you please help bik?