user3340931
user3340931

Reputation: 43

TFS 2015 On Premise REST API 404 searching test runs or results

Using the TFS 2015 REST API to try to get test runs and results with 404. When fetching projects or teams it works fine.

var uri = $"http://tfsserver:8080/tfs/project/_apis/test/runs/1994/results"; 

using (WebClient wc = new WebClient())
{
    wc.UseDefaultCredentials = true;
    wc.Credentials = CredentialCache.DefaultCredentials;
    var result = wc.DownloadString(uri);
    Console.WriteLine(result);
}
Console.Read();

The following URLs do not work: (NOTE: I removed the server portion because of a limitation of stackoverflow)

.../tfs/project/_apis/test/runs

But these do work:

.../tfs/project/_apis/projects/CodedUi/teams .../tfs/project/_apis/projects

Upvotes: 4

Views: 310

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51093

You are using the wrong url, lack of team project collection name.

http://tfsserver:8080/tfs/Yourcollection/project/_apis/test/runs/1994/results?api-version=1.0

And since there are two versions of API 1.0,3.0, suggest you also add the related API version. More details please refer this tutorial: Get a list of test results

Upvotes: 1

Related Questions