简体   繁体   中英

How to get AssociatedWorkItem from TFS Build via Rest API in C#?

I have some questions about the new tfs rest api :-)

first question: The new TFS Rest API interface is really nice, but how can I parse the JSON Object (eg /builds/ list) to a valid C# Object? Is there a Object in the Microsoft references, which I can use or do i have to string of Json?

second question: I need the associated work items of the current TFS build (by Build ID?), it was easy to do it in the old TFS C# API. Is it possible for the new rest api as well?

  1. You could 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. Check this case: What object returns from TFS2015 RestAPI

  2. Yes. You can get the associated work items of the current TFS build with REST API: https://www.visualstudio.com/en-us/docs/integrate/api/build/builds#work-items

The REST API is as below:

POST https://{instance}/DefaultCollection/{project}/_apis/build/builds/{buildId}/workitems?api-version={version}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM