Work item classification nodes

Last Update: 3/6/2017

api-version = 1.0

All work items have an area and an iteration field. The values that these fields can have are defined in the classification hierarchies.

If you haven't already, look at the information on getting started with these APIs.

Get a list of classification nodes

GET https://{instance}/DefaultCollection/{project}/_apis/wit/classificationnodes/{nodeType}/[{nodePath}]?api-version={version}[&$depth={int}]
Property Type Description
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of a team project that contains the classification nodes.
nodeType enum {areas, iterations} The type of classification node you are trying access.
nodePath string Path of the classification node.
Query
api-version string Version of the API to use.
$depth int Depth of children to retrieve.

Get the root area tree

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/areas?api-version=1.0

Sample response

Status code: 200
{
  "id": 3568,
  "name": "Fabrikam-Fiber-Git",
  "structureType": "area",
  "hasChildren": true,
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public void GetAreasRoot()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";

   using (var client = new HttpClient())
   {
       client.BaseAddress = new Uri("https://accountname.visualstudio.com/");
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       HttpResponseMessage response = client.GetAsync(_project + "/_apis/wit/classificationNodes/areas?api-version=2.2").Result;

       if (response.IsSuccessStatusCode)
       {
          var results = response.Content.ReadAsStringAsync().Result;
       }
   }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void GetAreasRoot()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";    
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
       WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(_project, TreeStructureGroup.Areas, null, 0).Result;
   }
}

Get the area tree with 2 levels of children

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/areas?$depth=2&api-version=1.0

Sample response

Status code: 200
{
  "id": 3568,
  "name": "Fabrikam-Fiber-Git",
  "structureType": "area",
  "hasChildren": true,
  "children": [
    {
      "id": 4482,
      "name": "Devices",
      "structureType": "area",
      "hasChildren": true,
      "children": [
        {
          "id": 4483,
          "name": "Windows Phone",
          "structureType": "area",
          "hasChildren": false,
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Devices/Windows%20Phone"
        },
        {
          "id": 4484,
          "name": "Surface",
          "structureType": "area",
          "hasChildren": false,
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Devices/Surface"
        },
        {
          "id": 4485,
          "name": "iPhone",
          "structureType": "area",
          "hasChildren": false,
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Devices/iPhone"
        }
      ],
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Devices"
    },
    {
      "id": 4486,
      "name": "Website",
      "structureType": "area",
      "hasChildren": false,
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Website"
    },
    {
      "id": 4487,
      "name": "Backend",
      "structureType": "area",
      "hasChildren": true,
      "children": [
        {
          "id": 4488,
          "name": "Database",
          "structureType": "area",
          "hasChildren": false,
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Backend/Database"
        },
        {
          "id": 4489,
          "name": "Middle-tier",
          "structureType": "area",
          "hasChildren": false,
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Backend/Middle-tier"
        }
      ],
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Backend"
    }
  ],
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public void GetAreasWithChildren()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";

   using (var client = new HttpClient())
   {
       client.BaseAddress = new Uri("https://accountname.visualstudio.com/");
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       HttpResponseMessage response = client.GetAsync(_project + "/_apis/wit/classificationNodes/areas?$depth=2&api-version=2.2").Result;

       if (response.IsSuccessStatusCode)
       {
           var results = response.Content.ReadAsStringAsync().Result;
       }      
   }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void GetAreasWithChildren()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";    
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
       WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(_project, TreeStructureGroup.Areas, null, 2).Result;
   }
}

Get the root iteration tree

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/iterations?api-version=1.0

Sample response

Status code: 200
{
  "id": 3569,
  "name": "Fabrikam-Fiber-Git",
  "structureType": "iteration",
  "hasChildren": true,
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public void GetIterationRoot()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";

   using (var client = new HttpClient())
   {
       client.BaseAddress = new Uri("https://accountname.visualstudio.com/");
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       HttpResponseMessage response = client.GetAsync(_project + "/_apis/wit/classificationNodes/iterations?api-version=2.2").Result;

       if (response.IsSuccessStatusCode)
       {
           var results = response.Content.ReadAsStringAsync().Result;
       }      
   }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void GetIterationsRoot()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";    
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
       WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(_project, TreeStructureGroup.Iterations, null, 0).Result;
   }
}

Get the iteration tree with 2 levels of children

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/iterations?$depth=2&api-version=1.0

Sample response

Status code: 200
{
  "id": 3569,
  "name": "Fabrikam-Fiber-Git",
  "structureType": "iteration",
  "hasChildren": true,
  "children": [
    {
      "id": 3566,
      "name": "Release 3",
      "structureType": "iteration",
      "hasChildren": false,
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Release%203"
    },
    {
      "id": 3571,
      "name": "Release 2",
      "structureType": "iteration",
      "hasChildren": false,
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Release%202"
    },
    {
      "id": 3572,
      "name": "Release 4",
      "structureType": "iteration",
      "hasChildren": false,
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Release%204"
    },
    {
      "id": 3576,
      "name": "Release 1",
      "structureType": "iteration",
      "hasChildren": true,
      "children": [
        {
          "id": 3564,
          "name": "Sprint 4",
          "structureType": "iteration",
          "hasChildren": false,
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Release%201/Sprint%204"
        },
        {
          "id": 3565,
          "name": "Sprint 2",
          "structureType": "iteration",
          "hasChildren": false,
          "attributes": {
            "startDate": "2014-03-17T00:00:00Z",
            "finishDate": "2014-03-28T00:00:00Z"
          },
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Release%201/Sprint%202"
        },
        {
          "id": 3567,
          "name": "Sprint 6",
          "structureType": "iteration",
          "hasChildren": false,
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Release%201/Sprint%206"
        },
        {
          "id": 3573,
          "name": "Sprint 5",
          "structureType": "iteration",
          "hasChildren": false,
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Release%201/Sprint%205"
        },
        {
          "id": 3574,
          "name": "Sprint 1",
          "structureType": "iteration",
          "hasChildren": false,
          "attributes": {
            "startDate": "2014-03-03T00:00:00Z",
            "finishDate": "2014-03-14T00:00:00Z"
          },
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Release%201/Sprint%201"
        },
        {
          "id": 3575,
          "name": "Sprint 3",
          "structureType": "iteration",
          "hasChildren": false,
          "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Release%201/Sprint%203"
        }
      ],
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Release%201"
    }
  ],
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public void GetIterationsWithChildren()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";

   using (var client = new HttpClient())
   {
       client.BaseAddress = new Uri("https://accountname.visualstudio.com/");
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       HttpResponseMessage response = client.GetAsync(_project + "/_apis/wit/classificationNodes/iterations?$depth=2&api-version=2.2").Result;

       if (response.IsSuccessStatusCode)
       {
           var results = response.Content.ReadAsStringAsync().Result;
       }      
   }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void GetIterationsWithChildren()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";    
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
       WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(_project, TreeStructureGroup.Iterations, null, 2).Result;
   }

Get a classification node

GET https://{instance}/DefaultCollection/{project}/_apis/wit/classificationnodes/{nodeType}/{nodePath}?api-version={version}[&$depth={int}]
Parameter Name Type Description
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of a team project that contains the classification nodes.
nodeType enum {areas, iterations} The type of classification node you are trying access.
nodePath string Path of the classification node.
Query
api-version string Version of the API to use.
$depth int Depth of children to retrieve.

Get an area

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/areas/Web?api-version=1.0

Sample response

Status code: 200
{
  "id": 126391,
  "name": "Web",
  "structureType": "area",
  "hasChildren": false,
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Web"
    },
    "parent": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Web"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public void GetArea()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";
   string _path = "Area Foo";

   using (var client = new HttpClient())
   {
       client.BaseAddress = new Uri("https://accountname.visaulstudio.com/");
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       HttpResponseMessage response = client.GetAsync(project + "/_apis/wit/classificationNodes/areas/" + _path + "?api-version=2.2").Result;

       if (response.IsSuccessStatusCode)
       {
          var result = response.Content.ReadAsStringAsync().Result;
       }
  }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void GetArea()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";    
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";
   string _path = "Area Foo";

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
       {
           WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(_project, TreeStructureGroup.Areas, _path, 0).Result;
       }
   }
}

Get an iteration

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/iterations/Final%20Iteration?api-version=1.0

Sample response

Status code: 200
{
  "id": 126392,
  "name": "Final Iteration",
  "structureType": "iteration",
  "hasChildren": false,
  "attributes": {
    "startDate": "2014-10-27T00:00:00Z",
    "finishDate": "2014-10-31T00:00:00Z"
  },
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Final%20Iteration"
    },
    "parent": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Final%20Iteration"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public void GetIteration()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";
   string _path = "Iteration Foo";

   using (var client = new HttpClient())
   {
       client.BaseAddress = new Uri("https://accountname.visaulstudio.com/");
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       HttpResponseMessage response = client.GetAsync(project + "/_apis/wit/classificationNodes/iterations/" + _path + "?api-version=2.2").Result;

       if (response.IsSuccessStatusCode)
       {
          var result = response.Content.ReadAsStringAsync().Result;
       }
  }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void GetIteration()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";    
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";
   string _path = "Iteration Foo";

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
       {
           WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(project, TreeStructureGroup.Iterations, _path, 0).Result;
       }
   }
}

Create a classification node

POST https://{instance}/DefaultCollection/{project}/_apis/wit/classificationnodes/{nodeType}/{nodePath}?api-version={version}[&$depth={int}]
Parameter Name Type Description
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of a team project that contains the classification nodes.
nodeType enum {areas, iterations} The type of classification node you are trying access.
nodePath string Path of the classification nodes.
Query
api-version string Version of the API to use.
Body
name string Name of the classification node.
attributes array of name/value pairs Additional attributes of the node. E.g. startDate and finishDate for iterations.

Create an area

Sample request

POST https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/areas?api-version=1.0
Content-Type: application/json
{
  "name": "Web"
}

Sample response

Status code: 201
{
  "id": 126391,
  "name": "Web",
  "structureType": "area",
  "hasChildren": false,
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Web"
    },
    "parent": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Web"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public class WorkItemClassifcationNode
{
   public int id { get; set; }
   public string name { get; set; }             
   public Attributes attributes { get; set; }           
}

public class Attributes
{
   public DateTime startDate { get; set; }
   public DateTime finishDate { get; set; }
}   

public void CreateArea()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";

   WorkItemClassifcationNode node = new WorkItemClassifcationNode()
   {
       name = "Area Foo"               
   };    

   using (var client = new HttpClient())
   {
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       // serialize the fields array into a json string          
       var postValue = new StringContent(JsonConvert.SerializeObject(node), Encoding.UTF8, "application/json");
       var method = new HttpMethod("POST");

       // send the request
       var request = new HttpRequestMessage(method, "https://accountname.visualstudio.com/" + _project + "/_apis/wit/classificationNodes/areas?api-version=2.2") { Content = postValue };
       var response = client.SendAsync(request).Result;

       if (response.IsSuccessStatusCode)
       {
           viewModel = response.Content.ReadAsStringAsync().Result;            
       }       
   }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void CreateArea()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";    
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";
   string _path = "Area Foo";

   WorkItemClassificationNode node = new WorkItemClassificationNode()
   {
       Name = name,
       StructureType = TreeNodeStructureType.Area
   };

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
           WorkItemClassificationNode result = workItemTrackingHttpClient.CreateOrUpdateClassificationNodeAsync(node, _project, TreeStructureGroup.Areas, _path).Result;
   } 
}

Create an iteration

Sample request

POST https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/iterations?api-version=1.0
Content-Type: application/json
{
  "name": "Final Iteration",
  "attributes": {
    "startDate": "2014-10-27T00:00:00Z",
    "finishDate": "2014-10-31T00:00:00Z"
  }
}

Sample response

Status code: 201
{
  "id": 126392,
  "name": "Final Iteration",
  "structureType": "iteration",
  "hasChildren": false,
  "attributes": {
    "startDate": "2014-10-27T00:00:00Z",
    "finishDate": "2014-10-31T00:00:00Z"
  },
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Final%20Iteration"
    },
    "parent": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Final%20Iteration"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public class WorkItemClassifcationNode
{
   public int id { get; set; }
   public string name { get; set; }             
   public Attributes attributes { get; set; }           
}

public class Attributes
{
   public DateTime startDate { get; set; }
   public DateTime finishDate { get; set; }
}   

public void CreateIteration()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";

   WorkItemClassifcationNode node = new WorkItemClassifcationNode()
   {
       name = "Iteration Foo",
       attributes = new CreateUpdateNodeViewModel.Attributes()
       {
          startDate = "2016-10-27T00:00:00Z",
          finishDate = "2016-11-6T00:00:00Z"
       }               
   };    

   using (var client = new HttpClient())
   {
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       // serialize the fields array into a json string          
       var postValue = new StringContent(JsonConvert.SerializeObject(node), Encoding.UTF8, "application/json");
       var method = new HttpMethod("POST");

       // send the request
       var request = new HttpRequestMessage(method, "https://accountname.visualstudio.com/" + _project + "/_apis/wit/classificationNodes/iterations?api-version=2.2") { Content = postValue };
       var response = client.SendAsync(request).Result;

       if (response.IsSuccessStatusCode)
       {
           var result = response.Content.ReadAsStringAsync().Result;            
       }       
   }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void CreateIteration()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";    
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";
   string _path = "Iteration Foo";

   IDictionary<string, Object> dict = new Dictionary<string, Object>();

   dict.Add("startDate", "2016-10-27T00:00:00Z");
   dict.Add("finishDate", "2016-11-6T00:00:00Z");

   WorkItemClassificationNode node = new WorkItemClassificationNode()
   {
       Name = _path,
       StructureType = TreeNodeStructureType.Iteration,
       Attributes = dict  
   };

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
      WorkItemClassificationNode result = workItemTrackingHttpClient.CreateOrUpdateClassificationNodeAsync(node, _project, TreeStructureGroup.Areas, _path).Result;
   } 
}

Update a classification node

PATCH https://{instance}/DefaultCollection/{project}/_apis/wit/classificationnodes/{nodeType}/{nodePath}?api-version={version}
Parameter Name Type Description
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of a team project that contains the classification nodes.
nodeType enum {areas, iterations} The type of classification node you are trying access.
nodePath string Path of the classification nodes.
Query
api-version string Version of the API to use.
Body
name string Name of the classification node.
attributes array of name/value pairs Additional attributes of the node. E.g. startDate and finishDate for iterations.

Update iteration dates

Start and end dates for iterations can be accessed and set through the startDate and finishDate attributes on iteration nodes.

Sample request

PATCH https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/iterations/Ultimate%20iteration?api-version=1.0
Content-Type: application/json
{
  "attributes": {
    "startDate": "2015-01-26T00:00:00Z",
    "finishDate": "2015-01-30T00:00:00Z"
  }
}

Sample response

Status code: 200
{
  "id": 126392,
  "name": "Ultimate iteration",
  "structureType": "iteration",
  "hasChildren": false,
  "attributes": {
    "startDate": "2015-01-26T00:00:00Z",
    "finishDate": "2015-01-30T00:00:00Z"
  },
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Ultimate%20iteration"
    },
    "parent": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Ultimate%20iteration"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public class WorkItemClassifcationNode
{
   public int id { get; set; }
   public string name { get; set; }
   public Attributes attributes { get; set; }
}

public class Attributes
{
   public DateTime startDate { get; set; }
   public DateTime finishDate { get; set; }
}

public void UpdateIterationDates()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";
   string _path = "Iteration Foo";

   WorkItemClassifcationNode node = new WorkItemClassifcationNode()
   {
       attributes = new CreateUpdateNodeViewModel.Attributes() {
          startDate = "2016-10-27T00:00:00Z",
          finishDate = "2016-11-6T00:00:00Z"
       }
   };

   using (var client = new HttpClient())
   {
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       // serialize the fields array into a json string
       var patchValue = new StringContent(JsonConvert.SerializeObject(node), Encoding.UTF8, "application/json");
       var method = new HttpMethod("PATCH");

       // send the request
       var request = new HttpRequestMessage(method, "https://accountname.visualstudio.com/" + _project + "/_apis/wit/classificationNodes/iterations/" + _path + "?api-version=2.2") { Content = patchValue };
       var response = client.SendAsync(request).Result;

       if (response.IsSuccessStatusCode) {
           var result = response.Content.ReadAsStringAsync().Result;
       }
   }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void UpdateIterationDates()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";
   string _path = "Iteration Foo";

   IDictionary<string, Object> dict = new Dictionary<string, Object>();

   dict.Add("startDate", "2016-10-27T00:00:00Z");
   dict.Add("finishDate", "2016-11-6T00:00:00Z");

   WorkItemClassificationNode node = new WorkItemClassificationNode()  {
       StructureType = TreeNodeStructureType.Iteration,
       Attributes = dict
   };

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
      WorkItemClassificationNode result = workItemTrackingHttpClient.UpdateClassificationNodeAsync(node, _project, TreeStructureGroup.Iterations, _path).Result;
   }
}

Rename a classification node

Sample request

PATCH https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/areas/Web?api-version=1.0
Content-Type: application/json
{
  "name": "Website team"
}

Sample response

Status code: 200
{
  "id": 126391,
  "name": "Website team",
  "structureType": "area",
  "hasChildren": false,
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Website%20team"
    },
    "parent": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Website%20team"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public class WorkItemClassifcationNode
{
   public int id { get; set; }
   public string name { get; set; }
   public Attributes attributes { get; set; }
}

public class Attributes
{
   public DateTime startDate { get; set; }
   public DateTime finishDate { get; set; }
}

public void RenameArea()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";
   string _currentPath = "Area Foo";

   WorkItemClassifcationNode node = new WorkItemClassifcationNode() {
      name = "Website Team"
   };

   using (var client = new HttpClient())
   {
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       // serialize the fields array into a json string
       var patchValue = new StringContent(JsonConvert.SerializeObject(node), Encoding.UTF8, "application/json");
       var method = new HttpMethod("PATCH");

       // send the request
       var request = new HttpRequestMessage(method, "https://accountname.visualstudio.com/" + _project + "/_apis/wit/classificationNodes/areas/" + _currentPath + "?api-version=2.2") { Content = patchValue };
       var response = client.SendAsync(request).Result;

       if (response.IsSuccessStatusCode) {
           var result = response.Content.ReadAsStringAsync().Result;
       }
   }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void RenameArea()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";
   string _currentPath = "Area Foo";

   WorkItemClassificationNode node = new WorkItemClassificationNode() {
      Name = "Website Team",
      StructureType = TreeNodeStructureType.Area
   };

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
      WorkItemClassificationNode result = workItemTrackingHttpClient.UpdateClassificationNodeAsync(node, _project, TreeStructureGroup.Areas, _currentPath).Result;
   }
}

Move a classification node

POST https://{instance}/DefaultCollection/{project}/_apis/wit/classificationnodes/{nodeType}/{targetNodeName}?api-version={version}
Parameter Name Type Description
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of a team project that contains the classification nodes.
nodeType enum {areas, iterations} The type of classification node you are trying access.
targetNodePath string Path of the target parent classification node.
Query
api-version string Version of the API to use.
Body
id int ID of the node being moved.

Move an area node

Sample request

POST https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/areas/Parent%20Area?api-version=1.0
Content-Type: application/json
{
  "id": 126391
}

Sample response

Status code: 200
{
  "id": 126391,
  "name": "Website team",
  "structureType": "area",
  "hasChildren": false,
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Parent%20Area/Website%20team"
    },
    "parent": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Parent%20Area"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Areas/Parent%20Area/Website%20team"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public class WorkItemClassifcationNode
{
   public int id { get; set; }
   public string name { get; set; }
   public Attributes attributes { get; set; }
}

public class Attributes
{
   public DateTime startDate { get; set; }
   public DateTime finishDate { get; set; }
}

public void MoveArea()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";
   string _targetAreaPath = "Different Area Path";

   WorkItemClassifcationNode node = new WorkItemClassifcationNode() {
      id = 126391
   };

   using (var client = new HttpClient())
   {
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       // serialize the fields array into a json string
       var postValue = new StringContent(JsonConvert.SerializeObject(node), Encoding.UTF8, "application/json");
       var method = new HttpMethod("POST");

       // send the request
       var request = new HttpRequestMessage(method, "https://accountname.visualstudio.com/" + _project + "/_apis/wit/classificationNodes/areas/" + _targetAreaPath + "?api-version=2.2") { Content = postValue };
       var response = client.SendAsync(request).Result;

       if (response.IsSuccessStatusCode) {
           var result = response.Content.ReadAsStringAsync().Result;
       }
   }
}

Coming Soon

Move an iteration node

Sample request

POST https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/iterations/Parent%20Iteration?api-version=1.0
Content-Type: application/json
{
  "id": 126392
}

Sample response

Status code: 200
{
  "id": 126392,
  "name": "Ultimate iteration",
  "structureType": "iteration",
  "hasChildren": false,
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Parent%20Iteration/Ultimate%20iteration"
    },
    "parent": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Parent%20Iteration"
    }
  },
  "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c/_apis/wit/classificationNodes/Iterations/Parent%20Iteration/Ultimate%20iteration"
}

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public class WorkItemClassifcationNode
{
   public int id { get; set; }
   public string name { get; set; }
   public Attributes attributes { get; set; }
}

public class Attributes
{
   public DateTime startDate { get; set; }
   public DateTime finishDate { get; set; }
}

public void MoveIteration()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";
   string _targetIterationPath = "Different Iteration Path";

   WorkItemClassifcationNode node = new WorkItemClassifcationNode() {
      id = 126392
   };

   using (var client = new HttpClient())
   {
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       // serialize the fields array into a json string
       var postValue = new StringContent(JsonConvert.SerializeObject(node), Encoding.UTF8, "application/json");
       var method = new HttpMethod("POST");

       // send the request
       var request = new HttpRequestMessage(method, "https://accountname.visualstudio.com/" + _project + "/_apis/wit/classificationNodes/iterations/" + _targetIterationPath + "?api-version=2.2") { Content = postValue };
       var response = client.SendAsync(request).Result;

       if (response.IsSuccessStatusCode) {
           var result = response.Content.ReadAsStringAsync().Result;
       }
   }
}

Coming Soon

Delete a classification node

DELETE https://{instance}/DefaultCollection/{project}/_apis/wit/classificationnodes/{nodeType}/{nodePath}?api-version={version}[?$reclassifyId={reclassifyId}]
Parameter Name Type Description
URL
instance string VS Team Services account ({account}.visualstudio.com) or TFS server ({server:port}).
project string Name or ID of a team project that contains the classification nodes.
nodeType enum {areas, iterations} The type of classification node you are trying access.
nodePath string Path of the classification nodes.
Query
api-version string Version of the API to use.
reclassifyId string ID of the node where work items of the deleted node are moved.

Delete an area node

Sample request

DELETE https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/areas/Parent%20Area?$reclassifyId=3568&api-version=1.0

Sample response

Status code: 204

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public void DeleteArea()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";
   string _areaPath = "Parent Area";
   string _reclassifyId = "3568";

   using (var client = new HttpClient())
   {
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       // serialize the fields array into a json string
       var method = new HttpMethod("DELETE");

       // send the request
       var request = new HttpRequestMessage(method, "https://accountname.visualstudio.com/" + _project + "/_apis/wit/classificationNodes/areas/" + _areaPath + "?$reclassifyId=" + _reclassifyId + "&api-version=2.2");
       var response = client.SendAsync(request).Result;
   }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void DeleteArea()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";
   string _areaPath = "Parent Area";
   int _reclassifyId = 3568;

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
      workItemTrackingHttpClient.DeleteClassificationNodeAsync(project, TreeStructureGroup.Areas, _areaPath, _reclassifyId).SyncResult();
   }
}

Delete an iteration node

Sample request

DELETE https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/wit/classificationNodes/iterations/Parent%20Iteration?$reclassifyId=3569&api-version=1.0

Sample response

Status code: 204

Sample Code

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public void DeleteIteration()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";
   string _iterationPath = "Parent Iteration";
   string _reclassifyId = "3569";

   using (var client = new HttpClient())
   {
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       // serialize the fields array into a json string
       var method = new HttpMethod("DELETE");

       // send the request
       var request = new HttpRequestMessage(method, "https://accountname.visualstudio.com/" + _project + "/_apis/wit/classificationNodes/iterations/" + _iterationPath + "?$reclassifyId=" + _reclassifyId + "&api-version=2.2");
       var response = client.SendAsync(request).Result;
   }
}
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;

...

public void DeleteIteration()
{
   //create uri and VssBasicCredential variables
   Uri _uri = new Uri("https://accountname.visualstudio.com/");
   string _personalAccessToken = "your personal access token";
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";
   string _iterationPath = "Parent Iteration";
   int _reclassifyId = 3569;

   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
      workItemTrackingHttpClient.DeleteClassificationNodeAsync(project, TreeStructureGroup.Iterations, _iterationPath, _reclassifyId).SyncResult();
   }
}

Samples

Getting Started

If this is your first time using the REST API's or .Net Libraries, check out the geting started sample first.

All sample source code can be found in our GitHub repo.

Get Full Area or Iteration Tree

Get the full tree of area paths. You can do the same with iterations by changing the type to Iterations.

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;

...

public class Node
{
   public int id { get; set; }
   public string name { get; set; }
   public string structureType { get; set; }
   public bool hasChildren { get; set; }
   public Child[] children { get; set; }
   public string url { get; set; }
}

public class Child
{
   public int id { get; set; }
   public string name { get; set; }
   public string structureType { get; set; }
   public bool hasChildren { get; set; }
   public string url { get; set; }
}

public List<string> GetAreaTree()
{
   string _personalAccessToken = "your personal access token";
   string _credentials = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", _personalAccessToken)));
   string _project = "My project name";

   Nodes result = new Nodes();
   List<string> list = new List<string>();

   using (var client = new HttpClient())
   {
       client.BaseAddress = new Uri("https://accountname.visualstudio.com/");
       client.DefaultRequestHeaders.Accept.Clear();
       client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
       client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _credentials);

       HttpResponseMessage response = client.GetAsync(_project + "/_apis/wit/classificationNodes/areas?api-version=2.2&$depth=2").Result;

       if (response.IsSuccessStatusCode)
       {
          nodes = response.Content.ReadAsAsync<GetNodesResponse.Nodes>().Result;
          walkTreedNode(client, project, nodes, "", list);
       }
   }
}

private void walkTreedNode(HttpClient client, string project, GetNodesResponse.Nodes node, string nodePath, List<string> list)
{
   HttpResponseMessage response;
   Nodes nodes;
   string name = string.Empty;

   foreach (var item in node.children)
   {
       if (String.IsNullOrEmpty(nodePath)) { name = item.name; }
       else { name = nodePath + "/" + item.name; }

       list.Add(name);

       if (item.hasChildren) {
           response = client.GetAsync(project + "/_apis/wit/classificationNodes/iterations/" + name + "?api-version=2.2&$depth=2").Result;

           if (response.IsSuccessStatusCode) {
               nodes = response.Content.ReadAsAsync<Nodes>().Result;
               walkTreedNode(client, project, nodes, name, list);
           }
       }
   }
}
using System;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models;
using Microsoft.VisualStudio.Services.Common;

...

public string GetFullTree()
{
   string _personalAccessToken = "your personal access token";
   string _projectName = "fabrikam"
   Uri _uri = new Uri("https://account.visualstudio.com");
   VssBasicCredential _credentials = new VssBasicCredential("", _personalAccessToken);
   string _project = "My project name";

   List<string> list = new List<string>();

   //use the workItemTrackingHttpClient
   using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials))
   {
       WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(_project, TreeStructureGroup.Areas, null, 1000).Result;

       list.Add(result.Name);

       foreach (var item in result.Children)
       {
          var name = result.Name + "/" + item.Name;

          list.Add(name);
          walkTreeNode(item, list, name);
       }
   }
}

public void walkTreeNode(WorkItemClassificationNode t, List<string> list, string node)
{
   if (t.Children != null)
   {
       foreach (WorkItemClassificationNode child in t.Children)
       {
           list.Add(node + "/" + child.Name);
           walkTreeNode(child, list, node + "/" + child.Name);
       }
   }
}

Contracts: WorkItemClassificationNode