Project

General

Profile

Actions

Rest api with powershell » History » Revision 5

« Previous | Revision 5/10 (diff) | Next »
Seung Soo Mun, 2020-10-24 20:36


Using the REST API with Powershell

Powershell

Invoke-RestMethod cmdlet

$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]}}'

using PSRedmine module

https://github.com/hamletmun/PSRedmine

Example

using Redmine-net-api dll

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

Example

Updated by Seung Soo Mun over 3 years ago · 5 revisions