プロジェクト

全般

プロフィール

Rest api with csharp » 履歴 » バージョン 1

Mitsuyoshi Yoshida, 2011/11/13 12:53

1 1 Mitsuyoshi Yoshida
redmine.org の "Rest_api_with_csharp":http://www.redmine.org/projects/redmine/wiki/Rest_api_with_csharp の日本語訳です。
2
3
h1. .NET での REST API の使用法
4
5
Redmine REST API でのアクセスに使える .NET のライブラリには "Redmine .NET API library":https://code.google.com/p/redmine-net-api があります。これはサードパーティ製のフリー(Apache 2 オープンソースライセンス)なライブラリです。
6
7
8
+使用例(C#)+:
9
10
<pre><code class="cpp">
11
using System;
12
using System.Collections.Specialized;
13
using Redmine.Net.Api;
14
using Redmine.Net.Api.Types;
15
16
namespace RedmineTest
17
{
18
    class Program
19
    {
20
        static void Main(string[] args)
21
        {
22
            string host = "";
23
            string apiKey = "";
24
25
            var manager = new RedmineManager(host, apiKey);
26
27
            var parameters = new NameValueCollection {{"status_id", "*"}};
28
            foreach (var issue in manager.GetObjectList<Issue>(parameters))
29
            {
30
                Console.WriteLine("#{0}: {1}", issue.Id, issue.Subject);
31
            }
32
33
            // チケットの作成
34
            var newIssue = new Issue { Subject = "test", Project = new IdentifiableName{Id =  1}};
35
            manager.CreateObject(newIssue);
36
37
        }
38
    }
39
}
40
</code></pre>