プロジェクト

全般

プロフィール

Rest Issues » 履歴 » バージョン 5

Mitsuyoshi Yoshida, 2011/11/15 23:30

1 1 Mitsuyoshi Yoshida
redmine.org の "Rest_Issues":http://www.redmine.org/projects/redmine/wiki/Rest_Issues の日本語訳です。
2
3
{{>toc}}
4
5
h1. REST チケット
6
7
h2. 一覧
8
9
<pre>GET /issues.xml</pre>
10
11 2 Mitsuyoshi Yoshida
チケットの一覧を取得します。レスポンスはページ割りされたチケットのリストで、デフォルトでは未完了のチケットのみ対象となります。
12 1 Mitsuyoshi Yoshida
13
+パラメーター+:
14
15
共通パラメーター:
16
17
* @offset@
18
* @limit@
19
* @page@
20
21
フィルターオプション:
22
23
* @project_id@: 指定したプロジェクトのチケットだけを取得します。 プロジェクトの指定は ID または 識別子で行います。 
24
* @tracker_id@: ID でトラッカーを指定します。
25
* @status_id@: チケットのステータスを指定します。以下の値だけ使用可能です。
26
** @open@ (未完了)
27
** @closed@ (完了)
28
** @*@ (すべて)
29
* @assigned_to_id@: 指定したユーザーが担当者になっているチケットだけ取得します。ユーザー ID で指定します。
30
* @cf_x@: カスタムフィールドの値が指定した値と一致するチケットだけを取得します。 @x@ は対象となるカスタムフィールドの ID です。
31 5 Mitsuyoshi Yoshida
  (カスタムフィールドの設定で [ *フィルタとして使う* ] にチェックが入っている必要があります。) 
32
  !cf_settings.png!
33 1 Mitsuyoshi Yoshida
* ...
34
35
36
+例+:
37
38
<pre>
39
GET /issues.xml
40
GET /issues.xml?project_id=2
41
GET /issues.xml?project_id=2&tracker_id=1
42
GET /issues.xml?assigned_to_id=6
43
GET /issues.xml?status_id=closed
44
GET /issues.xml?status_id=*
45
GET /issues.xml?cf_1=abcdef
46
47
ページ割りの例:
48
GET /issues.xml?project_id=testproject&query_id=2&offset=0&limit=100
49
GET /issues.xml?project_id=testproject&query_id=2&offset=50&limit=100
50
</pre>
51
52
53
54
+レスポンス+:
55
56
<pre><code class="xml">
57
<?xml version="1.0" encoding="UTF-8"?>
58
<issues type="array" count="1640">
59
  <issue>
60
    <id>4326</id>
61
    <project name="Redmine" id="1"/>
62
    <tracker name="Feature" id="2"/>
63
    <status name="New" id="1"/>
64
    <priority name="Normal" id="4"/>
65
    <author name="John Smith" id="10106"/>
66
    <category name="Email notifications" id="9"/>
67
    <subject>
68
      Aggregate Multiple Issue Changes for Email Notifications
69
    </subject>
70
    <description>
71
      This is not to be confused with another useful proposed feature that
72
      would do digest emails for notifications.
73
    </description>
74
    <start_date>2009-12-03</start_date>
75
    <due_date></due_date>
76
    <done_ratio>0</done_ratio>
77
    <estimated_hours></estimated_hours>
78
    <custom_fields>
79
      <custom_field name="Resolution" id="2">Duplicate</custom_field>
80
      <custom_field name="Texte" id="5">Test</custom_field>
81
      <custom_field name="Boolean" id="6">1</custom_field>
82
      <custom_field name="Date" id="7">2010-01-12</custom_field>
83
    </custom_fields>
84
    <created_on>Thu Dec 03 15:02:12 +0100 2009</created_on>
85
    <updated_on>Sun Jan 03 12:08:41 +0100 2010</updated_on>
86
  </issue>
87
  <issue>
88
    <id>4325</id>
89
    ...
90
  </issue>
91
</issues>
92
</code></pre>
93
94
95
h2. 表示
96
97 3 Mitsuyoshi Yoshida
id で指定したチケット情報を取得します。
98
99 1 Mitsuyoshi Yoshida
+パラメーター+:
100
101
* @include@: 以下の値が使用可能です。
102
** children (子チケット)
103
** attachments (添付ファイル)
104
** relations (関連するチケット)
105
** changesets (リポジトリのチェンジセット)
106
** journals (履歴)
107
108
109
+XML を使用+:
110
111
<pre>
112
GET /issues/[id].xml
113
</pre>
114
115
116
+JSON を使用+:
117
118
<pre>
119
GET /issues/[id].json
120
</pre>
121
122
123
h2. 作成
124
125 3 Mitsuyoshi Yoshida
XML または JSON で定義したチケットを作成します。
126
127 1 Mitsuyoshi Yoshida
+使用可能な要素+:
128 2 Mitsuyoshi Yoshida
129 1 Mitsuyoshi Yoshida
* subject (題名)
130
* project_id (プロジェクト)
131
* priority_id (優先度)
132
* description (説明)
133
* category_id (カテゴリ)
134
* assigned_to_id (担当者)
135
  指定した ID のユーザーをチケットの担当者にします。(現状ではユーザー名での指定は出来ません)
136
* status_id (ステータス)
137
* ...
138
139
140
+XML を使用+:
141
142
<pre>
143
  POST /issues.xml
144
</pre><pre><code class="xml">
145
  <?xml version="1.0"?>
146
  <issue>
147
    <subject>Example</subject>
148
    <project_id>1</project_id>
149
    <priority_id>4</priority_id>
150
  </issue>
151
</code></pre>
152
153
154
155
+JSON を使用+:
156
157
<pre>POST /issues.json</pre><pre><code class="json">
158
{
159
    "issue": {
160
      "project_id": "example",
161
      "subject": "Test issue",
162
      "custom_field_values":{
163
                              "1":"1.1.3"  #the affected version field
164
      }
165
    }
166
}
167
</code></pre>
168
169
170
h2. 更新
171
172 3 Mitsuyoshi Yoshida
id で指定したチケットに対して XML または JSON で定義した情報で更新します。
173
174 1 Mitsuyoshi Yoshida
+XML を使用+:
175
176
  PUT /issues/[id].xml
177
178
179
+JSON を使用+:
180
181
<pre>PUT /issues/[id].json</pre><pre><code class="json">
182
{
183
    "issue": {
184
      "subject": "Example issue (was: Test issue)",
185
      "notes": "Changing the subject"
186
    }
187
}</code></pre>
188
189
190
h2. 削除
191 3 Mitsuyoshi Yoshida
192
id で指定したチケットを削除します。
193 1 Mitsuyoshi Yoshida
194
  DELETE /issues/[id].xml
195