项目

通用

配置文件

操作

使用 PowerShell REST API

Powershell

Invoke-RestMethod 命令

Invoke-RestMethod http://demo.redmine.org/issues/12345.json?key=a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0
Invoke-RestMethod http://demo.redmine.org/projects/12.json?key=a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0
Invoke-RestMethod http://demo.redmine.org/versions/123.json?key=a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0

Invoke-RestMethod -Headers @{'X-Redmine-API-Key'='a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0'} http://demo.redmine.org/issues/12345.json
Invoke-RestMethod -Headers @{'X-Redmine-API-Key'='a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0'} http://demo.redmine.org/projects/12.json
Invoke-RestMethod -Headers @{'X-Redmine-API-Key'='a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0'} http://demo.redmine.org/versions/123.json

# Attach a file to an issue

Invoke-RestMethod -Headers @{'X-Redmine-API-Key'='a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0'} -Method POST -ContentType 'application/octet-stream' -Infile C:\image.jpg http://demo.redmine.org/uploads.json?filename=image.jpg

upload
------
@{id=234567; token=234567.a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0a1b2}

Invoke-RestMethod -Headers @{'X-Redmine-API-Key'='a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0'} -Method PUT -ContentType 'application/json' -Body '{"issue":{"uploads":[{"token": "234567.a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0a1b2", "filename": "image.jpg", "content_type": "image/jpg"}]}}' http://demo.redmine.org/issues/123456.json
Invoke-RestMethod -Headers @{'X-Redmine-API-Key'='a1b2c3d4e5f6g7h8i9j0a1b2c3d4e5f6g7h8i9j0'} http://demo.redmine.org/issues/123456.json?include=attachments | ConvertTo-Json

$Cred = Get-Credential

Invoke-RestMethod http://demo.redmine.org/issues/12345.json -Credential $Cred
Invoke-RestMethod http://demo.redmine.org/projects/12.json -Credential $Cred
Invoke-RestMethod http://demo.redmine.org/versions/123.json -Credential $Cred

(Invoke-RestMethod http://demo.redmine.org/issues.json -Credential $Cred).issues
(Invoke-RestMethod http://demo.redmine.org/projects.json -Credential $Cred).projects
(Invoke-RestMethod http://demo.redmine.org/projects/12/versions.json -Credential $Cred).versions

Invoke-RestMethod http://demo.redmine.org/projects/12.json -Credential $Cred -Method PUT -ContentType 'application/json' -Body '{"project": {"default_version_id": "398"}}'
Invoke-RestMethod http://demo.redmine.org/projects/testproject.json -Credential $Cred -Method PUT -ContentType 'application/json' -Body '{"project": {"default_version_id": "398"}}'

Invoke-RestMethod http://demo.redmine.org/projects/12/versions.json -Credential $Cred -Method POST -ContentType 'application/json' -Body '{"version": {"name": "Test ver", "description": "Test version desc"}}'
Invoke-RestMethod http://demo.redmine.org/issues.json -Credential $Cred -Method POST -ContentType 'application/json' -Body '{"issue": {"project_id": 438, "subject": "test watchers", "watcher_user_ids": [7,11,110]}}'

使用 PSRedmine 模块

https://github.com/hamletmun/PSRedmine

示例

使用 Redmine-net-api dll

https://github.com/JamesNK/Newtonsoft.Json
https://github.com/zapadi/redmine-net-api

示例

其他

最后更新于 Seung Soo Mun 3个月前 · 11次修订