Curl Script - Post a file (multipart/form-data)


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Old 04-28-2014
Curl Script - Post a file (multipart/form-data)

Hi All,

I am trying to post an xml file (utf-16 encoded) using curl to a REST service. The REST service is expecting 'multipart/form-data' content type.

Code:
curl -k -i -H "Content-Type=multipart/form-data" -F "filename=@file.xml;type=text/xml" -X POST -u <username>:<password> <endPointURL>

However, i am getting 500 Internal Server error while running the script.
Code:
<= Recv header, 23 bytes (0x17)
0000: HTTP/1.1 100 Continue
<= Recv header, 36 bytes (0x24)
0000: HTTP/1.1 500 Internal Server Error

Through chrome's add on 'postman app' i am able to successfully post the xml to the REST service.

Unable to figure out the issue causing the 500 error. Kindly help me in resolving this issue.

Regards
Anooja

Last edited by Scott; 04-28-2014 at 09:19 AM.. Reason: Please use code tags
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
CURL - Post Form Isssue ( sequel ) Fred13 Web Development 4 2 Weeks Ago 12:33 PM
Curl - post form issue Fred13 Web Development 3 2 Weeks Ago 06:11 AM
How to post content file of data using curl? fajar_3t3 Shell Programming and Scripting 0 03-19-2018 01:33 AM
Html form to submit data to bash script robertkwild Programming 3 07-20-2017 08:31 AM
Wget and curl to post data SkySmart Shell Programming and Scripting 1 10-12-2016 06:03 PM
How to use cURL to download web page with autentification (form)? MarcelOrMittal UNIX for Beginners Questions & Answers 1 08-04-2016 12:15 PM
Data Post with curl iddfcr Web Development 1 11-17-2014 11:34 AM
Transpose Data form Different form asavaliya Shell Programming and Scripting 2 10-18-2012 12:29 AM
create txt file form data file and add some line on it asavaliya Shell Programming and Scripting 3 10-14-2012 03:41 AM
Using cURL to submit a post form hansvg Shell Programming and Scripting 2 07-24-2012 03:50 PM
Copy data form File A and Create File B asavaliya Shell Programming and Scripting 7 07-14-2012 04:11 AM
Posting data to a form using curl DeCoTwc UNIX for Dummies Questions & Answers 0 05-30-2010 04:34 AM
Issue in Curl to send http POST request with attachment/multipart manishmaha UNIX for Advanced & Expert Users 1 05-19-2010 02:12 AM
maintaining form post session using curl Allasso Shell Programming and Scripting 1 01-13-2009 06:26 PM