What object returns from TFS2015 RestAPI

后端 未结 2 700
南旧
南旧 2021-01-29 04:20

I\'m using TFS 2015 rest api in order to retrieve build definitions and builds details using those calls:

definitions: http:///tfs/DefaultCollection//_apis/build/definit

相关标签:
2条回答
  • 2021-01-29 05:16

    I use Json.NET to manipulate JSON data. You can find plenty of examples in this library web site.

    0 讨论(0)
  • 2021-01-29 05:24

    You could use install this Nuget package for your project and in the package. The assemblies in this package has already help you transfer the json data to the corresponding object. For example, to get something about build, you could use the Microsoft.TeamFoundation.Build.WebApi assembly. To get a build definition:

    var u = new Uri("http://serverName:8080/tfs/MyCollection/");
    VssCredentials c = new VssCredentials(new Microsoft.VisualStudio.Services.Common.WindowsCredential(new NetworkCredential("userName", "password", "domain")));
    var connection = new VssConnection(u, c);
    var buildServer = connection.GetClient<BuildHttpClient>();            
    BuildDefinition builddef = buildServer.GetDefinitionAsync("AgileMttGreen",10).Result;
    Console.WriteLine(builddef.Name);
    
    0 讨论(0)
提交回复
热议问题