Actions
Rest api with csharp » History » Revision 5
« Previous |
Revision 5/6
(diff)
| Next »
Maxim Okunev, 2024-08-19 21:55
Relevant from https://github.com/zapadi/redmine-net-api/wiki/Get-a-redmine-object
Using the REST API with .NET¶
Redmine .NET API library is a FREE third-party C# library that can be used to access the Redmine API. It is released under Apache 2 open-source license.
To use this library from PowerShell, see REST API with PowerShell
Sample usage:
using System; using System.Collections.Specialized; using Redmine.Net.Api; using Redmine.Net.Api.Types; namespace RedmineTest { class Program { static void Main(string[] args) { string host = ""; string apiKey = ""; string issueId = "<issue-id>"; var manager = new RedmineManager(host, apiKey); //parameter - fetch associated relations. var parameters = new NameValueCollection {{RedmineKeys.INCLUDE, RedmineKeys.RELATIONS}}; var issue = manager.GetObject<Issue>(issueId, parameters); Console.WriteLine("Issue: {0}.", issue); //Create a issue. Issue newissue = new Issue(); newissue.Project = IdentifiableName.Create<IdentifiableName>(id: 1); newissue.Tracker = IdentifiableName.Create<IdentifiableName>(id: 1); newissue.Subject = "Example"; newissue.Description = "Description"; Issue savedIssue = manager.CreateObject(newissue); } } }
Updated by Maxim Okunev 4 months ago · 5 revisions