/タスク
以下はよく寄せられる質問です:
- タスクの状態を変更する ID#219
取得する /api/v1/tasks/219?include=[EntityState[NextStates ]] (状態のIDを知るため)
POST to /api/v1/tasks/219 ペイロード { \"EntityState\":{\"Id\":87 }}
- タスクのカスタムフィールド「内部用」に値「true」を設定する ID#167
POST TO /api/v1/tasks/167 payload { \"CustomFields\":[{\"Name\":\"Is internal\",\"Value\":\"true\"}]}
- ストーリーに対してタスクを作成する ID#194
プロジェクトのID /api/v1/userstories/194?include=[Project を知る
POST to /api/v1/tasks payload {\"Name\":\"New task\",\"Project\": {\"Id\":2},\"UserStory\":{\"Id\":194 }}
- タスクに新しいコメントを追加する ID#219
POST to /api/v1/comments payload {\"Description\":\"New comment\",\"General\": {\"Id\":219} }
- タスクに費やした時間を追加する ID#219
POST to /api/v1/times payload {\"Spent\":2,\"Remain\":1,\"Description\":\"Some work\",\"Role\": {\"Id\":1},\"Assignable\": {\"Id\":219} }
- タスク ID#219 の見積もり(開発者向け5ストーリーポイント、QA向け2ストーリーポイント)
POST to /api/v1/tasks/219 payload {\"Roleefforts\":[{\"Role\": {\"Id\":1},\"Effort\":5},{\"Role\": {\"Id\":9},\"Effort\":2}]}
- プロジェクト ID#194 内のストーリーに ID#2 タスクを追加し、ユーザー ID#6 を開発者として割り当てる
POST to /api/v1/tasks payload {\"Name\":\"New task\",\"Project\": {\"Id\":2},\"UserStory\":{\"Id\":194 },\"Assignments\":[{ \"GeneralUser\":{\"Id\":6 },\"Role\": {\"Id\":1} }]}
- プロジェクト ID#194 内のストーリーにタスクを追加し、 ID#2 ユーザー ID#6 を開発者として割り当て、開発作業を10ストーリーポイントで見積もる
POST to /api/v1/tasks payload {\"Name\":\"New task\",\"Project\": {\"Id\":2},\"UserStory\":{\"Id\":194 },\"Assignments\":[{ \"GeneralUser\":{\"Id\":6 },\"Role\": {\"Id\":1} }],\"Roleefforts\":[{\"Role\": {\"Id\":1},\"Effort\":10}]}
- 複数のタスク ID#168ID#167 について予定日を設定する
POST /api/v1/tasks/bulk ペイロード [ {\"Id\":167,\"PlannedStartDate\":\"2017-03-19\",\"PlannedEndDate\":\"2017-08-29\"}, {\"Id\":168,\"PlannedStartDate\":\"2017-03-19\",\"PlannedEndDate\":\"2017-08-29\"} ]
- ストーリーに対して複数のタスクを作成する ID#194
プロジェクトのID /api/v1/userstories/194?include=[Project を知る
POST to /api/v1/tasks/bulk payload [{\"Project\": {\"Id\":192},\"Name\":\"First Task\",\"UserStory\":{\"Id\":194 }},\"Project\": {\"Id\":192},\"Name\":\"Second Task\",\"UserStory\":{\"Id\":194 }}]","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;
//create a new Task in Project ID#2
string query = "tasks";
HttpContent payload = new StringContent("{\"Name\":\"New Task\",\"Project\":{\"Id\":2},\"UserStory\":{\"Id\":16}}", Encoding.UTF8, "application/json");
//using access token generated at Personal Details page (Access Tokens tab)
query += "?access_token=NjplaXdQeTJDOHVITFBta0QyME85QlhEOWpwTGdPM2V6VjIyelZlZ0NKWG1RPQ==";
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;
//create a new Task in Project ID#2
string query = "tasks";
HttpContent payload = new StringContent("{\"Name\":\"New Task\",\"Project\":{\"Id\":2},\"UserStory\":{\"Id\":16}}", Encoding.UTF8, "application/json");
//using a token generated at /api/v1/Authentication
query += "?token=Njo4OTIyQzkzN0M5NEY3NzNENDIyNTM2RDU3MTMwMTMwOA==";
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;
//create a new Task in Project ID#2
string query = "tasks";
HttpContent payload = new StringContent("{\"Name\":\"New Task\",\"Project\":{\"Id\":2},\"UserStory\":{\"Id\":16}}", Encoding.UTF8, "application/json");
//using basic authentication (here 'John' is login and '123' is password)
string authentication = Convert.ToBase64String(Encoding.ASCII.GetBytes("John:123"));
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;
//create a new Task in Project ID#2
string query = "tasks";
HttpContent payload = new StringContent("{\"Name\":\"New Task\",\"Project\":{\"Id\":2},\"UserStory\":{\"Id\":16}}", 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);
}
}
}
}