Rest IssueRelations » History » Version 9
Toshi MARUYAMA, 2019-10-18 16:08
add POST example
| 1 | 1 | Jean-Philippe Lang | h1. Issue Relations |
|---|---|---|---|
| 2 | |||
| 3 | {{>toc}} |
||
| 4 | |||
| 5 | 2 | Jean-Philippe Lang | h2. /issues/:issue_id/relations.:format |
| 6 | 1 | Jean-Philippe Lang | |
| 7 | 2 | Jean-Philippe Lang | h3. GET |
| 8 | |||
| 9 | Returns the relations for the issue of given id (:issue_id). |
||
| 10 | |||
| 11 | 7 | Toshi MARUYAMA | +XML example+: |
| 12 | 2 | Jean-Philippe Lang | |
| 13 | <pre> |
||
| 14 | GET /issues/8470/relations.xml |
||
| 15 | </pre> |
||
| 16 | |||
| 17 | +Response+: |
||
| 18 | |||
| 19 | 6 | Go MAEDA | <pre><code class="xml"> |
| 20 | 2 | Jean-Philippe Lang | <?xml version="1.0" encoding="UTF-8"?> |
| 21 | <relations type="array"> |
||
| 22 | <relation> |
||
| 23 | <id>1819</id> |
||
| 24 | <issue_id>8470</issue_id> |
||
| 25 | <issue_to_id>8469</issue_to_id> |
||
| 26 | <relation_type>relates</relation_type> |
||
| 27 | <delay/> |
||
| 28 | </relation> |
||
| 29 | <relation> |
||
| 30 | <id>1820</id> |
||
| 31 | <issue_id>8470</issue_id> |
||
| 32 | <issue_to_id>8467</issue_to_id> |
||
| 33 | <relation_type>relates</relation_type> |
||
| 34 | <delay/> |
||
| 35 | </relation> |
||
| 36 | </relations> |
||
| 37 | 1 | Jean-Philippe Lang | </code></pre> |
| 38 | 7 | Toshi MARUYAMA | |
| 39 | +json example+: |
||
| 40 | |||
| 41 | <pre> |
||
| 42 | GET /issues/8470/relations.json |
||
| 43 | </pre> |
||
| 44 | |||
| 45 | +Response+: |
||
| 46 | |||
| 47 | <pre><code class="json"> |
||
| 48 | { |
||
| 49 | "relations": [ |
||
| 50 | { |
||
| 51 | "delay": null, |
||
| 52 | "id": 1819, |
||
| 53 | "issue_id": 8470, |
||
| 54 | "issue_to_id": 8469, |
||
| 55 | "relation_type": "relates" |
||
| 56 | }, |
||
| 57 | { |
||
| 58 | "delay": null, |
||
| 59 | "id": 1820, |
||
| 60 | "issue_id": 8470, |
||
| 61 | "issue_to_id": 8467, |
||
| 62 | "relation_type": "relates" |
||
| 63 | } |
||
| 64 | ] |
||
| 65 | } |
||
| 66 | </code> |
||
| 67 | </pre> |
||
| 68 | 2 | Jean-Philippe Lang | |
| 69 | Note: when getting an issue, relations can also be retrieved in a single request using @/issues/:id.:format?include=relations@. |
||
| 70 | |||
| 71 | 1 | Jean-Philippe Lang | h3. POST |
| 72 | |||
| 73 | Creates a relation for the issue of given id (:issue_id). |
||
| 74 | |||
| 75 | +Parameters+: |
||
| 76 | |||
| 77 | * @relation@ (required): a hash of the relation attributes, including: |
||
| 78 | |||
| 79 | * @issue_to_id@ (required): the id of the related issue |
||
| 80 | 5 | Sahya Norn | * @relation_type@ (required to explicit : default "relates"): the type of relation (in: "relates", "duplicates", "duplicated", "blocks", "blocked", "precedes", "follows", "copied_to", "copied_from") |
| 81 | 1 | Jean-Philippe Lang | * @delay@ (optional): the delay for a "precedes" or "follows" relation |
| 82 | |||
| 83 | +Response+: |
||
| 84 | |||
| 85 | * @201 Created@: relation was created |
||
| 86 | * @422 Unprocessable Entity@: relation was not created due to validation failures (response body contains the error messages) |
||
| 87 | |||
| 88 | 9 | Toshi MARUYAMA | +Examples+: |
| 89 | |||
| 90 | <pre> |
||
| 91 | POST /issues/83/relations.xml |
||
| 92 | </pre> |
||
| 93 | <pre><code class="xml"> |
||
| 94 | <?xml version="1.0" encoding="UTF-8"?> |
||
| 95 | <relation> |
||
| 96 | <issue_to_id>82</issue_to_id> |
||
| 97 | <relation_type>relates</relation_type> |
||
| 98 | </relation> |
||
| 99 | </code></pre> |
||
| 100 | <pre> |
||
| 101 | POST /issues/83/relations.json |
||
| 102 | </pre> |
||
| 103 | <pre><code class="json"> |
||
| 104 | { |
||
| 105 | "relation": { |
||
| 106 | "issue_to_id": 82, |
||
| 107 | "relation_type": "relates" |
||
| 108 | } |
||
| 109 | } |
||
| 110 | </code></pre> |
||
| 111 | |||
| 112 | 3 | Jean-Philippe Lang | h2. /relations/:id.:format |
| 113 | 1 | Jean-Philippe Lang | |
| 114 | h3. GET |
||
| 115 | |||
| 116 | Returns the relation of given id. |
||
| 117 | 2 | Jean-Philippe Lang | |
| 118 | 8 | Toshi MARUYAMA | +XML example+: |
| 119 | 2 | Jean-Philippe Lang | |
| 120 | <pre> |
||
| 121 | 3 | Jean-Philippe Lang | GET /relations/1819.xml |
| 122 | 2 | Jean-Philippe Lang | </pre> |
| 123 | 1 | Jean-Philippe Lang | |
| 124 | +Response+: |
||
| 125 | |||
| 126 | 6 | Go MAEDA | <pre><code class="xml"> |
| 127 | 1 | Jean-Philippe Lang | <?xml version="1.0" encoding="UTF-8"?> |
| 128 | <relation> |
||
| 129 | <id>1819</id> |
||
| 130 | <issue_id>8470</issue_id> |
||
| 131 | <issue_to_id>8469</issue_to_id> |
||
| 132 | <relation_type>relates</relation_type> |
||
| 133 | <delay/> |
||
| 134 | </relation> |
||
| 135 | 8 | Toshi MARUYAMA | </code></pre> |
| 136 | |||
| 137 | +json example+: |
||
| 138 | |||
| 139 | <pre> |
||
| 140 | GET /relations/1819.json |
||
| 141 | </pre> |
||
| 142 | |||
| 143 | +Response+: |
||
| 144 | |||
| 145 | <pre><code class="json"> |
||
| 146 | { |
||
| 147 | "relation": { |
||
| 148 | "delay": null, |
||
| 149 | "id": 1819, |
||
| 150 | "issue_id": 8470, |
||
| 151 | "issue_to_id": 8469, |
||
| 152 | "relation_type": "relates" |
||
| 153 | } |
||
| 154 | } |
||
| 155 | 6 | Go MAEDA | </code></pre> |
| 156 | 1 | Jean-Philippe Lang | |
| 157 | h3. DELETE |
||
| 158 | |||
| 159 | Deletes the relation of given id. |
||
| 160 | |||
| 161 | +Response+: |
||
| 162 | |||
| 163 | * @200 OK@: relation was deleted |
||
| 164 | * @422 Unprocessable Entity@: relation was not deleted (response body contains the error messages) |