/プロジェクト
以下に人気のクエリをいくつか挙げます:
- プロジェクトの状態を変更する ID#13
取得する /api/v1/projects/13?include=[EntityState[NextStates ]] (状態のIDを知るため)
POST to /api/v1/projects/13 ペイロード { \"EntityState\":{\"Id\":124 }}
- プロジェクトのカスタムフィールド「予算」に値125000を設定する ID#2
POST TO /api/v1/projects/2 ペイロード { \"CustomFields\":[{\"Name\":\"Budget\",\"Value\":125000 }]}
- プロジェクトに新しいコメントを追加する ID#2
POST to /api/v1/comments payload {\"Description\":\"New comment\",\"General\": {\"Id\":2} }
- プロジェクトにユーザーストーリーを作成する ID#2
POST to /api/v1/userstories ペイロード {\"Name\":\"New Story\",\"Project\": {\"Id\":2} }
- プロセスを使用して新しいプロジェクト ID#2 を作成し、ユーザー ID#6 を開発者として割り当てます
POST to /api/v1/projects payload {\"Name\":\"Kanban Project\",\"Process\": {\"Id\":2},\"ProjectMembers\":[{\"User\":{\"Id\":6 },\"Role\": {\"Id\":1} }]}
- 複数のプロジェクト ID#13ID#2 の予定日を設定する
POST /api/v1/projects/bulk ペイロード [ {\"Id\":2,\"PlannedStartDate\":\"2017-03-19\",\"PlannedEndDate\":\"2017-08-29\"}, {\"Id\":13,\"PlannedStartDate\":\"2017-03-19\",\"PlannedEndDate\":\"2017-08-29\"} ]
- プロセス#2および#3を含む複数のプロジェクトを作成する
POST to /api/v1/projects/bulk payload [{\"Process\": {\"Id\":2},\"Name\":\"First Project\"},{\"Process\": {\"Id\":3},\"Name\":\"Second Project\"}]","sidebar":true}
using System;
using System.Net;
using System.Net.Http;
using System.Text;
namespace REST.Test
{
class Program
{
static void Main(string[] args)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://restapi.tpondemand.com/api/v1/");
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
//assign User ID#6 to Project ID#229
string query = "projects";
HttpContent payload = new StringContent("{\"Id\":229,\"ProjectMembers\":[{\"User\":{\"Id\":6}}]}", Encoding.UTF8, "application/json");
//using access token generated at Personal Details page (Access Tokens tab)
query += "?access_token=MTpoUmx4WW1LTzF6dlkvbUN1dTZIclVBUFQyQ1Z0MkN6YnF6OHBETmRZN2kwPQ==";
Console.WriteLine("Posting to " + query);
HttpResponseMessage response = client.PostAsync(query, payload).Result;
if (response.IsSuccessStatusCode)
{
Console.WriteLine(response.Content.ReadAsStringAsync().Result);
}
else
{
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
}
}
}
}
using System;
using System.Net;
using System.Net.Http;
using System.Text;
namespace REST.Test
{
class Program
{
static void Main(string[] args)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://restapi.tpondemand.com/api/v1/");
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
//assign User ID#6 to Project ID#229
string query = "projects";
HttpContent payload = new StringContent("{\"Id\":229,\"ProjectMembers\":[{\"User\":{\"Id\":6}}]}", Encoding.UTF8, "application/json");
//using a token generated at /api/v1/Authentication
query += "?token=MTpGMjRERDMxODUzNDk1NjdFOTQ0NEY4NkFFOEJCMjkzMw==";
Console.WriteLine("Posting to " + query);
HttpResponseMessage response = client.PostAsync(query, payload).Result;
if (response.IsSuccessStatusCode)
{
Console.WriteLine(response.Content.ReadAsStringAsync().Result);
}
else
{
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
}
}
}
}
using System;
using System.Net;
using System.Net.Http;
using System.Text;
namespace REST.Test
{
class Program
{
static void Main(string[] args)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://restapi.tpondemand.com/api/v1/");
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
//assign User ID#6 to Project ID#229
string query = "projects";
HttpContent payload = new StringContent("{\"Id\":229,\"ProjectMembers\":[{\"User\":{\"Id\":6}}]}", Encoding.UTF8, "application/json");
//using basic authentication (here 'admin' is login and 'admin' is password)
string authentication = Convert.ToBase64String(Encoding.ASCII.GetBytes("admin:admin"));
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", authentication);
Console.WriteLine("Posting to " + query);
HttpResponseMessage response = client.PostAsync(query, payload).Result;
if (response.IsSuccessStatusCode)
{
Console.WriteLine(response.Content.ReadAsStringAsync().Result);
}
else
{
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
}
}
}
}
using System;
using System.Net;
using System.Net.Http;
using System.Text;
namespace REST.Test
{
class Program
{
static void Main(string[] args)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://restapi.tpondemand.com/api/v1/");
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
//assign User ID#6 to Project ID#229
string query = "projects";
HttpContent payload = new StringContent("{\"Id\":229,\"ProjectMembers\":[{\"User\":{\"Id\":6}}]}", Encoding.UTF8, "application/json");
//using no authentication will result in 401 Unauthorized response
Console.WriteLine("Posting to " + query);
HttpResponseMessage response = client.PostAsync(query, payload).Result;
if (response.IsSuccessStatusCode)
{
Console.WriteLine(response.Content.ReadAsStringAsync().Result);
}
else
{
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
}
}
}
}