Rest api with curl » History » Version 1
Jean-Philippe Lang, 2010-12-11 14:48
| 1 | 1 | Jean-Philippe Lang | h1. Using the REST API with cURL |
|---|---|---|---|
| 2 | |||
| 3 | "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. |
||
| 4 | |||
| 5 | Here is a simple example of a command that can be used to update an issue: |
||
| 6 | |||
| 7 | <pre> |
||
| 8 | curl -v -H "Content-Type:application/json" -X PUT --data "@388.json" -u login:password http://redmine/issues/388.json |
||
| 9 | </pre> |
||
| 10 | |||
| 11 | The file that contains the data sent to Redmine (388.json in the example above) would look like this: |
||
| 12 | |||
| 13 | <pre> |
||
| 14 | { |
||
| 15 | "issue": { |
||
| 16 | "subject": "subject123", |
||
| 17 | "notes": "Changing the subject" |
||
| 18 | } |
||
| 19 | } |
||
| 20 | </pre> |