Ask a Question

Trying to send a attachment in POST request

SOLVED
bik
Occasional Contributor

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.

 

7 REPLIES 7
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...



If my answer helped please click on the 'Accept as Solution' button.
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
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?



If my answer helped please click on the 'Accept as Solution' button.
TanyaYatskovska
SmartBear Alumni (Retired)

Hi Community,

 

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

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



bik
Occasional Contributor

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.

groovyguy
Champion Level 0

Thanks for circling back, @bik, and letting us know that you fixed it and how. 🙂




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
bik
Occasional Contributor

Another problem happening the same file upload this time .csv which is having issues.

For xml file the upload is working but not for the .csv file ,getting 400 Bad request 

 

 

cancel
Showing results for 
Search instead for 
Did you mean: