Rest api with curl » History » Version 2

Version 1 (Jean-Philippe Lang, 2010-12-11 14:48) → Version 2/10 (Jean-Philippe Lang, 2010-12-11 14:51)

h1. Using the REST API with cURL

"curl":http://curl.haxx.se/ is a command-line tool for transferring data using various protocols. It can be used to interact with the Redmine REST API.

Here is a simple example of a command that can be used to update an issue:

<pre>
curl -v -H "Content-Type:application/json" -X PUT --data "@388.json" -u login:password http://redmine/issues/388.json
</pre>

The file that contains the data sent to Redmine (388.json in the example above) would look like this:

<pre>
{
"issue": {
"subject": "subject123",
"notes": "Changing the subject"
}
}
</pre>

Note: it's required to set the @Content-Type@ header according to the format of the data you are sending. It must be set to one the following values:
* @application/json@
* @application/xml@