專案

一般

設定檔

動作

專案

列出專案

GET /projects.xml

返回所有專案(所有公開專案和使用者有權限的私人專案)

參數:

  • include:取得關聯資料(選填)。值應以逗號「,」分隔。可能的值
    • 追蹤器
    • 議題分類
    • 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:取得關聯資料(選填)。值應以逗號「,」分隔。可能的值
    • 追蹤器
    • 議題分類
    • 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(必填):專案識別碼
    • 描述
    • 首頁
    • is_public:true 或 false
    • parent_id:父專案編號
    • inherit_members:true 或 false
    • default_assigned_to_id:預設使用者的 ID。僅當新專案是子專案且繼承成員時有效。
    • default_version_id:預設版本的 ID。僅適用於現有的共用版本。
    • tracker_ids:(可重複元素)追蹤器 ID:1 表示錯誤,依此類推。
    • enabled_module_names:(可重複元素)模組名稱:看板、日曆、文件、檔案、甘特圖、議題追蹤、新聞、版本庫、時間追蹤、Wiki。
    • issue_custom_field_ids:(可重複元素)議題自訂欄位 ID。
    • custom_field_values:具有 id => 值 對的陣列
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 stable) 上使用 API 金鑰發送 POST 請求無法運作,但使用帳號密碼驗證則可以正常運作
#12104

Mischa The Evil9 個月前 更新 · 40 個版本