Rest IssueRelations » History » Version 8
Toshi MARUYAMA, 2019-10-18 14:51
get json
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 | 3 | Jean-Philippe Lang | h2. /relations/:id.:format |
89 | 1 | Jean-Philippe Lang | |
90 | h3. GET |
||
91 | |||
92 | Returns the relation of given id. |
||
93 | 2 | Jean-Philippe Lang | |
94 | 8 | Toshi MARUYAMA | +XML example+: |
95 | 2 | Jean-Philippe Lang | |
96 | <pre> |
||
97 | 3 | Jean-Philippe Lang | GET /relations/1819.xml |
98 | 2 | Jean-Philippe Lang | </pre> |
99 | 1 | Jean-Philippe Lang | |
100 | +Response+: |
||
101 | |||
102 | 6 | Go MAEDA | <pre><code class="xml"> |
103 | 1 | Jean-Philippe Lang | <?xml version="1.0" encoding="UTF-8"?> |
104 | <relation> |
||
105 | <id>1819</id> |
||
106 | <issue_id>8470</issue_id> |
||
107 | <issue_to_id>8469</issue_to_id> |
||
108 | <relation_type>relates</relation_type> |
||
109 | <delay/> |
||
110 | </relation> |
||
111 | 8 | Toshi MARUYAMA | </code></pre> |
112 | |||
113 | +json example+: |
||
114 | |||
115 | <pre> |
||
116 | GET /relations/1819.json |
||
117 | </pre> |
||
118 | |||
119 | +Response+: |
||
120 | |||
121 | <pre><code class="json"> |
||
122 | { |
||
123 | "relation": { |
||
124 | "delay": null, |
||
125 | "id": 1819, |
||
126 | "issue_id": 8470, |
||
127 | "issue_to_id": 8469, |
||
128 | "relation_type": "relates" |
||
129 | } |
||
130 | } |
||
131 | 6 | Go MAEDA | </code></pre> |
132 | 1 | Jean-Philippe Lang | |
133 | h3. DELETE |
||
134 | |||
135 | Deletes the relation of given id. |
||
136 | |||
137 | +Response+: |
||
138 | |||
139 | * @200 OK@: relation was deleted |
||
140 | * @422 Unprocessable Entity@: relation was not deleted (response body contains the error messages) |