操作
问题关系¶
/issues/:issue_id/relations.:format¶
GET¶
返回指定ID(:issue_id)问题的关系。
XML示例:
GET /issues/8470/relations.xml
响应:
<?xml version="1.0" encoding="UTF-8"?>
<relations type="array">
<relation>
<id>1819</id>
<issue_id>8470</issue_id>
<issue_to_id>8469</issue_to_id>
<relation_type>relates</relation_type>
<delay/>
</relation>
<relation>
<id>1820</id>
<issue_id>8470</issue_id>
<issue_to_id>8467</issue_to_id>
<relation_type>relates</relation_type>
<delay/>
</relation>
</relations>
json示例:
GET /issues/8470/relations.json
响应:
{ "relations": [ { "delay": null, "id": 1819, "issue_id": 8470, "issue_to_id": 8469, "relation_type": "relates" }, { "delay": null, "id": 1820, "issue_id": 8470, "issue_to_id": 8467, "relation_type": "relates" } ] }
注意:获取问题时,也可以通过使用 /issues/:id.:format?include=relations
在单个请求中检索关系。
POST¶
为指定ID(:issue_id)的问题创建关系。
参数:
relation
(必需):包含关系属性的一个哈希,包括issue_to_id
(必需):相关问题的IDrelation_type
(必需,以明确指定:默认 "relates"):关系的类型(in: "relates", "duplicates", "duplicated", "blocks", "blocked", "precedes", "follows", "copied_to", "copied_from")delay
(可选):"precedes" 或 "follows" 关系的延迟
响应:
201 Created
:关系已创建422 Unprocessable Entity
:由于验证失败,关系未创建(响应体包含错误消息)
示例:
POST /issues/83/relations.xml
<?xml version="1.0" encoding="UTF-8"?>
<relation>
<issue_to_id>82</issue_to_id>
<relation_type>relates</relation_type>
</relation>
POST /issues/83/relations.json
{
"relation": {
"issue_to_id": 82,
"relation_type": "relates"
}
}
/relations/:id.:format¶
GET¶
返回指定ID的关系。
XML示例:
GET /relations/1819.xml
响应:
<?xml version="1.0" encoding="UTF-8"?>
<relation>
<id>1819</id>
<issue_id>8470</issue_id>
<issue_to_id>8469</issue_to_id>
<relation_type>relates</relation_type>
<delay/>
</relation>
json示例:
GET /relations/1819.json
响应:
{
"relation": {
"delay": null,
"id": 1819,
"issue_id": 8470,
"issue_to_id": 8469,
"relation_type": "relates"
}
}
DELETE¶
删除指定ID的关系。
响应:
204 No Content
:关系已删除422 Unprocessable Entity
:关系未删除(响应体包含错误消息)