Rest Versions » History » Version 1
  Jean-Philippe Lang, 2011-07-04 21:03 
  
| 1 | 1 | Jean-Philippe Lang | h1. Versions | 
|---|---|---|---|
| 2 | |||
| 3 | {{>toc}} | ||
| 4 | |||
| 5 | h2. /projects/:project_id/versions.:format | ||
| 6 | |||
| 7 | h3. GET | ||
| 8 | |||
| 9 | Returns the versions available for the project of given id or identifier (:project_id). The response may include shared versions from other projects. | ||
| 10 | |||
| 11 | +Examples+: | ||
| 12 | |||
| 13 | <pre> | ||
| 14 | GET /project/foo/versions.xml | ||
| 15 | GET /project/1/versions.xml | ||
| 16 | </pre> | ||
| 17 | |||
| 18 | +Response+: | ||
| 19 | |||
| 20 | <pre> | ||
| 21 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 22 | <versions type="array" total_count="34"> | ||
| 23 | <version> | ||
| 24 | <id>1</id> | ||
| 25 | <project name="Redmine" id="1"/> | ||
| 26 | <name>0.7</name> | ||
| 27 | <description/> | ||
| 28 | <status>closed</status> | ||
| 29 | <due_date>2008-04-28</due_date> | ||
| 30 | <created_on>2008-03-09T12:52:06+01:00</created_on> | ||
| 31 | <updated_on>2009-11-15T12:22:12+01:00</updated_on> | ||
| 32 | </version> | ||
| 33 | <version> | ||
| 34 | <id>2</id> | ||
| 35 | <project name="Redmine" id="1"/> | ||
| 36 | <name>0.8</name> | ||
| 37 | <description/> | ||
| 38 | <status>closed</status> | ||
| 39 | <due_date>2008-12-30</due_date> | ||
| 40 | <created_on>2008-03-09T12:52:12+01:00</created_on> | ||
| 41 | <updated_on>2009-11-15T12:22:12+01:00</updated_on> | ||
| 42 | </version> | ||
| 43 | </versions> | ||
| 44 | </pre> | ||
| 45 | |||
| 46 | h3. POST | ||
| 47 | |||
| 48 | Creates a version for the project of given id or identifier (:project_id). | ||
| 49 | |||
| 50 | +Parameters+: | ||
| 51 | |||
| 52 | * @version@ (required): a hash of the version attributes, including: | ||
| 53 | |||
| 54 | * @name@ (required) | ||
| 55 | * @status@: the status of the version (in: "open", "locked", "closed") | ||
| 56 | * @sharing@: the version sharing (in: "none", "descendants", "hierarchy", "tree", "system") | ||
| 57 | * @due_date@ | ||
| 58 | * @description@ | ||
| 59 | |||
| 60 | +Response+: | ||
| 61 | |||
| 62 | * @201 Created@: version was created | ||
| 63 | * @422 Unprocessable Entity@: version was not created due to validation failures (response body contains the error messages) | ||
| 64 | |||
| 65 | h2. /projects/:project_id/versions/:id.:format | ||
| 66 | |||
| 67 | h3. GET | ||
| 68 | |||
| 69 | Returns the version of given id. | ||
| 70 | |||
| 71 | +Example+: | ||
| 72 | |||
| 73 | <pre> | ||
| 74 | GET /projects/foo/versions/2.xml | ||
| 75 | </pre> | ||
| 76 | |||
| 77 | +Response+: | ||
| 78 | |||
| 79 | <pre> | ||
| 80 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 81 | <version> | ||
| 82 | <id>2</id> | ||
| 83 | <project name="Redmine" id="1"/> | ||
| 84 | <name>0.8</name> | ||
| 85 | <description/> | ||
| 86 | <status>closed</status> | ||
| 87 | <due_date>2008-12-30</due_date> | ||
| 88 | <created_on>2008-03-09T12:52:12+01:00</created_on> | ||
| 89 | <updated_on>2009-11-15T12:22:12+01:00</updated_on> | ||
| 90 | </version> | ||
| 91 | </pre> | ||
| 92 | |||
| 93 | h3. PUT | ||
| 94 | |||
| 95 | Updates the version of given id | ||
| 96 | |||
| 97 | +Parameters+: | ||
| 98 | |||
| 99 | Same as version creation | ||
| 100 | |||
| 101 | +Response+: | ||
| 102 | |||
| 103 | * @200 OK@: version was updated | ||
| 104 | * @422 Unprocessable Entity@: version was not updated due to validation failures (response body contains the error messages) | ||
| 105 | |||
| 106 | h3. DELETE | ||
| 107 | |||
| 108 | Deletes the version of given id. | ||
| 109 | |||
| 110 | +Response+: | ||
| 111 | |||
| 112 | * @200 OK@: version was deleted | ||
| 113 | * @422 Unprocessable Entity@: version was not deleted (response body contains the error messages) |