Update existing or create a new User Story

Log in to see full request history

👍

More information

📘

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

Here are some popular queries:

  • change state for a Story ID#194
    GET to /api/v1/userstories/194?include=[EntityState[NextStates]] (to know ID of the state)
    POST to /api/v1/userstories/194 payload {"EntityState":{"Id":82}}

  • set value "Tech debt" for custom field "Work Type" for a Story ID#194
    POST TO /api/v1/userstories/194 payload {"CustomFields":[{"Name":"Work Type","Value":"Tech debt"}]}

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

  • add time spent for a Story ID#194
    POST to /api/v1/times payload {"Spent":2,"Remain":1,"Description":"Some work","Role":{"Id":1},"Assignable":{"Id":194}}

  • create a Task for a Story ID#194
    GET to /api/v1/userstories/194?include=[Project] (to know ID of the project)
    POST to /api/v1/tasks payload {"Name":"New task","Project":{"Id":2},"UserStory":{"Id":194}}

  • estimate a Story ID#194 (5 story points for Developer, 2 story points for QA)
    POST to /api/v1/userstories/194 payload {"Roleefforts":[{"Role":{"Id":1},"Effort":5},{"Role":{"Id":9},"Effort":2}]}

  • add a Story to a Project ID#2 and assign User ID#6 as Developer
    POST to /api/v1/userstories payload {"Name":"New story","Project":{"Id":2},"Assignments":[{"GeneralUser":{"Id":6},"Role":{"Id":1}}]}

  • add a Story to a Project ID#2, assign User ID#6 as Developer and estimate development work with 10 story points
    POST to /api/v1/userstories payload {"Name":"New story","Project":{"Id":2},"Assignments":[{"GeneralUser":{"Id":6},"Role":{"Id":1}}],"Roleefforts":[{"Role":{"Id":1},"Effort":10}]}

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

  • create several Stories for a Feature ID#206
    GET to /api/v1/features/206?include=[Project] (to know ID of the project)
    POST to /api/v1/UserStories/bulk payload [{"Project":{"Id":192},"Name":"First Story","Feature":{"Id":206}},{"Project":{"Id":192},"Name":"Second Story","Feature":{"Id":206}}]

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 User Stories in a Project ID#2 string query = "userstories"; HttpContent payload = new StringContent("{\"Name\":\"New Story\",\"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 User Stories in a Project ID#2 string query = "userstories"; HttpContent payload = new StringContent("{\"Name\":\"New Story\",\"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 User Stories in a Project ID#2 string query = "userstories"; HttpContent payload = new StringContent("{\"Name\":\"New Story\",\"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 User Stories in a Project ID#2 string query = "userstories"; HttpContent payload = new StringContent("{\"Name\":\"New Story\",\"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 Stories at once

You can operate with several Stories at once by using /api/v1/UserStories/bulk endpoint.

Query Params
string
Defaults to xml

Response format (JSON or XML)

string

Token, which was generated at Personal Details page (Access Tokens tab). Other options: token or basic authentication

string

Token, which was generated at /api/v1/Authentication. Other options: access_token or basic authentication

string

You can explicitly specify attributes of newly created or updated Story that you want to have in the response. It is possible to include Fields, Collections and Nested Entities (with inner Fields). Example: [Name, Iteration[Name]]. Cannot be used together with 'exclude' param.

string

You can explicitly specify attributes of newly created or updated Story that you do not want to have in the response. Cannot be used together with 'include' param.

Body Params
int32

Id of the Story you'd like to update (cannot be set when adding a new Story)

date
Defaults to Now

CreateDate can be set only while creating a new Story (cannot be changed for existing Stories)

string

Name of the Story

string

Description of the Story (in HTML or Markdown format, depending on your editor choice)

string

Comma-separated list of tags

date

When do you plan to start this Story

string

When do you plan to finish this Story

Project
object

Project this Story belongs to

Headers
string
Defaults to Basic YWRtaW46YWRtaW4x

Basic authentication as a a Base64 encoded values for login:password. Other options: access_token or token

string

Specify in which format (JSON or XML) and chartset (in case of not ASCII characters) you're sending the body. E.g.: application/xml or application/json; charset=UTF-8

Responses

Language
Request
Click Try It! to start a request and see the response here! Or choose an example:
application/json
application/xml
text/plain