操作
项目¶
列出项目¶
GET /projects.xml
返回所有项目(所有公开项目和用户有访问权限的私有项目)
参数:
include
:获取关联数据(可选)。值应通过逗号 "," 分隔。可能的值trackers
issue_categories
enabled_modules
(自2.6.0起)time_entry_activities
(自3.4.0起)issue_custom_fields
(自4.2.0起)
响应:
<projects type="array">
<project>
<id>1</id>
<name>Redmine</name>
<identifier>redmine</identifier>
<description>
Redmine is a flexible project management web application written using Ruby on Rails framework.
</description>
<created_on>Sat Sep 29 12:03:04 +0200 2007</created_on>
<updated_on>Sun Mar 15 12:35:11 +0100 2009</updated_on>
<is_public>true</is_public>
</project>
<project>
<id>2</id>
...
</project>
备注:
is_public
自2.6.0起公开
显示项目¶
GET /projects/[id].xml
返回给定id或标识符的项目。
参数:
include
:获取关联数据(可选)。值应通过逗号 "," 分隔。可能的值trackers
issue_categories
enabled_modules
(自2.6.0起)time_entry_activities
(自3.4.0起)issue_custom_fields
(自4.2.0起)
示例:
GET /projects/12.xml GET /projects/12.xml?include=trackers GET /projects/12.xml?include=trackers,issue_categories GET /projects/12.xml?include=enabled_modules GET /projects/redmine.xml
响应:
<?xml version="1.0" encoding="UTF-8"?>
<project id="1">
<name>Redmine</name>
<identifier>redmine</identifier>
<description>
Redmine is a flexible project management web application written using Ruby on Rails framework.
</description>
<homepage></homepage>
<status>1</status>
<parent id="123" name="foo"/>
<default_version id="3" name="2.0"/>
<default_assignee id="2" name="John Smith"/>
<created_on>Sat Sep 29 12:03:04 +0200 2007</created_on>
<updated_on>Sun Mar 15 12:35:11 +0100 2009</updated_on>
<is_public>true</is_public>
</project>
备注:
is_public
自2.6.0起公开
创建项目¶
POST /projects.xml
创建项目。
参数:
project
(必需):项目属性哈希,包括name
(必需):项目名称identifier
(必需):项目标识符description
homepage
is_public
:true或falseparent_id
:父项目编号inherit_members
:true或falsedefault_assigned_to_id
:默认用户的ID。只有当新项目是子项目并且继承成员时才有效。default_version_id
:默认版本的ID。仅与现有共享版本一起使用。tracker_ids
:(可重复元素)跟踪器ID:1代表错误,等等。enabled_module_names
:(可重复元素)模块名称:boards,calendar,documents,files,gantt,issue_tracking,news,repository,time_tracking,wiki。issue_custom_field_ids
:(可重复元素)问题自定义字段ID。custom_field_values
:包含id => value
对的数组
POST /projects.xml
<project>
<name>test project</name>
<identifier>test</identifier>
<enabled_module_names>time_tracking</enabled_module_names>
<enabled_module_names>issue_tracking</enabled_module_names>
</project>
POST /projects.json
{
"project":{
"name":"Example name",
"identifier":"example_name",
"description":"Description of exapmple project",
"is_public":false,
"parent_id":1,
"inherit_members":false,
"tracker_ids":[
1,
2,
3,
4,
5
],
"enabled_module_names":[
"issue_tracking"
],
"custom_field_values":{
"1":"VALUE"
}
}
}
响应:
201 Created
:项目已创建422 Unprocessable Entity
:由于验证失败,项目未创建(响应体包含错误消息)
更新项目¶
PUT /projects/[id].xml
更新给定id或标识符的项目。
存档项目¶
PUT /projects/[id]/archive.xml
存档给定id或标识符的项目。自Redmine 5.0起可用。
取消存档项目¶
PUT /projects/[id]/unarchive.xml
取消存档给定id或标识符的项目。自Redmine 5.0起可用。
删除项目¶
DELETE /projects/[id].xml
删除给定id或标识符的项目。
限制:¶
在Redmine 1.0.1-2(Debian稳定版)上使用API密钥进行POST请求不起作用,但使用登录/密码身份验证则可以工作
#12104
由Mischa The Evil更新9个月前 · 40次修订