Rest IssueRelations » History » Version 8

Toshi MARUYAMA, 2019-10-18 14:51
get json

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