0

This Question and its answers describes how to get the TestResults and other log items via REST Api. That excactly what i want to do. Provide TestResults and Log Files after a completed build.

How to get unit test results using TFS Rest API?

Also this page describes the REST Api.

REST Api

Im struggling with the url, on my side. My idea would be to navigate to desired register, when i am in the details of a completed build, and copy the shown url from the browser. I never did something with REST before, so maybe i have a complete wrong understanding.

We are using the OnPremise Version (i think it is called like this) not the VSonline Version.

May someone provide some information, where in the build to look for the needed url(s) or maybe show the schema how these urls are build so i can get an idea, where to start?

Community
  • 1
  • 1
Dom84
  • 852
  • 7
  • 20

1 Answers1

0

You can't directly copy the build url in the browser to meet the url. Just as this tutorial describes, the schema of url should be:

GET https://{instance}/DefaultCollection/{project}/_apis/build/builds/{buildId}/logs

For the sample request:

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/Fabrikam-Fiber-Git/_apis/build/builds/391/logs?api-version=2.0

enter image description here

You could see the every schema of the url. The only thing may be confused is build ID. You could find the related info of it in the build url from the browser. enter image description here

You could also take a look at Get started with the REST APIs

Update a sample with postman:

enter image description here

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • when i execute the url, setup up in the schema as described and with the information which matches with my desired build, tfs settings and so on, i get a "Website not found" message from the browser. should it display something in the browser if had set up the correct url for getting the log infos? If i use the tool "curl" as in the get startet page described, it always says wrong login information, but with the same login and pw i am able to logon in the browser if i navigate to the main page of our tfs. – Dom84 Nov 29 '16 at 09:53
  • Sorry i'm not familar with curl. If you want to test your rest api. Suggest you give a try with postman -link https://chrome.google.com/webstore/search/postman?hl=en – PatrickLu-MSFT Nov 29 '16 at 10:05
  • ok. but i understood right that this should also work with a locally installed version of the buildserver, correct? And the displayed schema of url should be the same for vsonline as well as locally installed? Because i always get a page not found error – Dom84 Nov 29 '16 at 10:20
  • Yes this should be the same with local installed TFS. There should a little difference such as server local server has a port info(8080) .I have updated a sample with postman for your reference. Could you add your url (Cover the personal information) in your update question? – PatrickLu-MSFT Nov 29 '16 at 17:06