/Features
Here are some popular queries:
- change state for Feature ID#206
GET to /api/v1/features/206?include=[EntityState[NextStates]] (to know ID of the state)
POST to /api/v1/features/212 payload {\"EntityState\":{\"Id\":107}}
- set value \"https://en.wikipedia.org/wiki/Wiki\" for custom field \"Wiki link\" for Feature ID#216
POST TO /api/v1/features/216 payload {\"CustomFields\":[{\"Name\":\"Wiki link\",\"Value\":{\"Url\":\"https://en.wikipedia.org/wiki/Wiki\",\"Label\":\"wiki\"}}]}
- add a new comment for Feature ID#206
POST to /api/v1/comments payload {\"Description\":\"New comment\",\"General\":{\"Id\":206}}
- create a User Story for Feature ID#206
GET to /api/v1/features/206?include=[Project] (to know ID of the project)
POST to /api/v1/userstories payload {\"Name\":\"New Story\",\"Project\":{\"Id\":2},\"Feature\":{\"Id\":206}}
- add a Feature to Project ID#2 and assign User ID#6 as Developer
POST to /api/v1/features payload {\"Name\":\"New Feature\",\"Project\":{\"Id\":2},\"Assignments\":[{\"GeneralUser\":{\"Id\":6},\"Role\":{\"Id\":1}}]}
- set planned dates for several Feature (ID#60 and ID#70)
POST to /api/v1/features/bulk payload [{\"Id\":60,\"PlannedStartDate\":\"2017-03-19\",\"PlannedEndDate\":\"2017-08-29\"},{\"Id\":70,\"PlannedStartDate\":\"2017-03-19\",\"PlannedEndDate\":\"2017-08-29\"}]
- create several Features in Project ID#2
POST to /api/v1/features/bulk payload [{\"Project\":{\"Id\":2},\"Name\":\"First Feature\"},{\"Project\":{\"Id\":192},\"Name\":\"Second Feature\"}]","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 Feature in Project ID#2
string query = "features";
HttpContent payload = new StringContent("{\"Name\":\"New Feature\",\"Project\":{\"Id\":2}}", 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 Feature in Project ID#2
string query = "features";
HttpContent payload = new StringContent("{\"Name\":\"New Feature\",\"Project\":{\"Id\":2}}", 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 Feature in Project ID#2
string query = "features";
HttpContent payload = new StringContent("{\"Name\":\"New Feature\",\"Project\":{\"Id\":2}}", 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 Feature in Project ID#2
string query = "features";
HttpContent payload = new StringContent("{\"Name\":\"New Feature\",\"Project\":{\"Id\":2}}", 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);
}
}
}
}