Update existing or create a new Project
More information
To update a Project you have to know its ID.
To add a new Project you have to know ID of its Process.
If you'd like to connect a Project to some resources (EntityState, Team, Owner, etc.) you have to know their IDs.
-
change state for Project ID#13
GET to /api/v1/projects/13?include=[EntityState[NextStates]] (to know ID of the state)
POST to /api/v1/projects/13 payload {EntityState:{Id:124}} -
set value 125000 for custom field "Budget" for Project ID#2
POST TO /api/v1/projects/2 payload {CustomFields:[{Name:"Budget",Value:125000}]} -
add a new comment for Project ID#2
POST to /api/v1/comments payload {Description:"New comment",General:{Id:2}} -
create a User Story in Project ID#2
POST to /api/v1/userstories payload {Name:"New Story",Project:{Id:2}} -
create a new Project with Process ID#2 and assign User ID#6 as Developer
POST to /api/v1/projects payload {Name:"Kanban Project",Process:{Id:2},ProjectMembers:[{User:{Id:6},Role:{Id:1}}]} -
set planned dates for several Projects (ID#2 and ID#13)
POST to /api/v1/projects/bulk payload [{Id:2,PlannedStartDate:'2017-03-19',PlannedEndDate:'2017-08-29'},{Id:13,PlannedStartDate:'2017-03-19',PlannedEndDate:'2017-08-29'}] -
create several Projects with Processes #2 and #3
POST to /api/v1/projects/bulk payload [{Process:{Id:2},Name:"First Project"},{Process:{Id:3},Name:"Second Project"}]
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);
}
}
}
}
Adding or updating several Projects at once
You can operate with several Features at once by using /api/v1/projects/bulk endpoint.