Redmine

RedmineへAPIで投稿する

X-Redmine-API-Key は「設定→APIタブでRESTによるWebサービスを有効にする」をチェックしないと取得できません。

curl -X POST \
  -H "Content-Type: application/json" \
  -H "X-Redmine-API-Key: 93b31b642ce021624b668ee0ccfe66e000d99c69" \
  -d '{
    "issue": {
      "project_id": "is-dept1-inquiry",
      "tracker_id": 1,
      "status_id": 1,
      "priority_id": 2,
      "subject": "API経由のテストチケット",
      "description": "これはAPIから登録したテストチケットです。",
      "assigned_to_id": 3
    }
  }' \
  http://your-redmine-host/issues.json
項目説明設定例
project_idプロジェクト識別子is-dept1-inquiry
tracker_idトラッカーID(urlでしか確認できない http://localhost:7070/trackers/1/edit1
status_idステータスID
http://localhost:7070/issue_statuses/1/edit
1
priority_id優先度ID(通常など)2
subjectチケットタイトル
description詳細説明
assigned_to_id担当者のユーザーID
$body = @{
  issue = @{
    project_id  = "is-dept1-inquiry"   # プロジェクト識別子
    tracker_id  = 1                    # トラッカーID(問い合わせなど)
    status_id   = 1                    # ステータスID(新規)
    priority_id = 2                    # 優先度ID(通常など)
    subject     = "API経由のテストチケット"
    description = "PowerShell + curl から投稿したテストチケットです。"
    assigned_to_id = 6                 # 担当者ID(任意)
  }
} | ConvertTo-Json -Depth 10
curl.exe -X POST http://localhost:7070/issues.json `
  -H "Content-Type: application/json" `
  -H "X-Redmine-API-Key: 93b31b642ce021624b668ee0ccfe66e000d99c69" `
  -d $body
redmine-docker >> curl.exe -X POST http://localhost:7070/issues.json `
>>   -H "Content-Type: application/json" `
>>   -H "X-Redmine-API-Key: 93b31b642ce021624b668ee0ccfe66e000d99c69" `
>>   -d $body | jq
  % Total    % Received % Xferd  Average Speed  Time    Time    Time   Current
                                 Dload  Upload  Total   Spent   Left   Speed
100    967 100    671 100    296   6135   2706                              0
{
  "issue": {
    "id": 5,
    "project": {
      "id": 1,
      "name": "情報システム部1課 問い合わせ管理"
    },
    "tracker": {
      "id": 1,
      "name": "問い合わせ"
    },
    "status": {
      "id": 1,
      "name": "新規",
      "is_closed": false
    },
    "priority": {
      "id": 2,
      "name": "通常"
    },
    "author": {
      "id": 6,
      "name": "PowerAutomate Bot"
    },
    "assigned_to": {
      "id": 6,
      "name": "PowerAutomate Bot"
    },
    "subject": "API経由のテストチケット",
    "description": "PowerShell + curl から投稿したテストチケットです。",
    "start_date": "2026-05-16",
    "due_date": null,
    "done_ratio": 0,
    "is_private": false,
    "estimated_hours": null,
    "total_estimated_hours": null,
    "created_on": "2026-05-16T11:50:33Z",
    "updated_on": "2026-05-16T11:50:33Z",
    "closed_on": null
  }
}
redmine-docker >>
スポンサーリンク
タイトルとURLをコピーしました