How can I send/post an xml file to a local server http://localhost:8080 using curl from the command line?
What command should I use?
How can I send/post an xml file to a local server http://localhost:8080 using curl from the command line?
What command should I use?
If that question is connected to your other Hudson questions use the command they provide.
You need to change it a little bit to read from a file:
Read the manpage. following an abstract for -d Parameter.
Here's how you can POST XML on Windows using curl command line on Windows. Better use batch/.cmd file for that:
You can using option --data with file.
Write xml content to a file named is soap_get.xml and using curl command to send request:
From the manpage, I believe these are the droids you are looking for:
So in your case, this would be something like
curl -F file=@/some/file/on/your/local/disk http://localhost:8080
If you are using curl on Windows:
With Jenkins 1.494, I was able to send a file to a job parameter on Ubuntu Linux 12.10 using
curl
with--form
parameters:On the Jenkins server, I configured a job that accepts a single parameter: a file upload parameter named
myfileparam
.The first line of that curl call constructs a web form with a parameter named
myfileparam
(same as in the job); its value will be the contents of a file on the local file system named/local/path/to/your/file.txt
. The@
symbol prefix tells curl to send a local file instead of the given filename.The second line defines a JSON request that matches the form parameters on line one: a file parameter named
myfileparam
.The third line activates the form's Build button. The forth line is the job URL with the "/build" suffix.
If this call is successful, curl returns
0
. If it is unsuccessful, the error or exception from the service is printed to the console. This answer takes a lot from an old blog post relating to Hudson, which I deconstructed and re-worked for my own needs.