Update existing or create a new Epic

👍

More information

📘

To update an Epic you have to know its ID.
To add a new Epic you have to know ID of its Project.
If you'd like to connect an Epic to some resources (EntityState, Team, Owner, etc.) you have to know their IDs.

Here are some popular queries:

  • change state for Epic ID#212
    GET to /api/v1/epics/212?include=[EntityState[NextStates]] (to know ID of the state)
    POST to /api/v1/epics/212 payload {"EntityState":{"Id":118}}

  • set value "4.5" for custom field "Approve date" for Epic ID#213
    POST TO /api/v1/epics/213 payload {CustomFields:[{"Name":"Approve date","Value":"2017-01-22"}]}

  • add a new comment for Epic ID#212
    POST to /api/v1/comments payload {"Description":"New comment","General":{"Id":212}}

  • create a Feature for Epic ID#212
    GET to /api/v1/epics/194?include=[Project] (to know ID of the project)
    POST to /api/v1/features payload {"Name":"New Feature","Project":{"Id":2},"Epic":{"Id":212}}

  • add an Epic to a Project ID#2 and assign User ID#6 as Project Manager
    POST to /api/v1/epics payload {"Name":"New Epic","Project":{"Id":2},"Assignments":[{"GeneralUser":{"Id":6},"Role":{"Id":7}}]}

  • set planned dates for several Epics (ID#211 and ID#212)
    POST to /api/v1/epics/bulk payload [{"Id":211 ,"PlannedStartDate":"2017-03-19","PlannedEndDate":"2017-08-29"},{"Id":212,"PlannedStartDate":"2017-03-19","PlannedEndDate":"2017-08-29"}]

  • create several Epics in Project ID#2
    POST to /api/v1/epics/bulk payload [{"Project":{"Id":2},"Name":"First Epic"},{"Project":{"Id":192},"Name":"Second Epic"}]

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 Epic in a Project ID#2
            string query = "epics";
            HttpContent payload = new StringContent("{\"Name\":\"New Epic\",\"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 Epic in a Project ID#2
            string query = "epics";
            HttpContent payload = new StringContent("{\"Name\":\"New Epic\",\"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 Epic in a Project ID#2
            string query = "epics";
            HttpContent payload = new StringContent("{\"Name\":\"New Epic\",\"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 Epic in a Project ID#2
            string query = "epics";
            HttpContent payload = new StringContent("{\"Name\":\"New Epic\",\"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);
            }
        }
    }
}

📘

Adding or updating several Epics at once

You can operate with several Epics at once by using /api/v1/epics/bulk endpoint.

Language
Click Try It! to start a request and see the response here!