TFS VSO REST API workitems (wit) paths give 404 errors - rest

I recently discovered that TFS has a RESTFul API and I am trying to pull information about workitems based on the documentation here: Work Items
I've been able to get information about projects using this path:
[host]/tfs/TFS_DefaultCollection/_apis/projects
but when I try
[host]/tfs/TFS_DefaultCollection/_apis/wit/workitems
or
[host]/tfs/TFS_DefaultCollection/_apis/wit/workitems?version=1.0-preview
I get a 404 error. I've tried a bunch of things based on various examples but I've not yet gotten anything back for any URI under the /wit/ path.
This question has an answer that suggests that this feature may not yet be supported in on-premises installations. Has anyone gotten this to work? There's a blurb about how you can get a 404 if you don't have premissions on the main REST Basics page for TFS. Is there some authorization setting required or am I just going to have to wait for a later version? We are running 2013 (Version 12.0.31101.0)

You're getting a 404 because those particular APIs aren't in the on-premise TFS 2013 product. They APIs are available from TFS 2015 CTP1 onwards.

Related

Member Entitlement Management VSTS API

I have been trying to work with the Member Entitlement Management VSTS API in Visual Studio. I am attempting to get the user entitlement summary, and am receiving an API locator error.
http://Microsoft.VisualStudio.Services.WebApi.VssResourceNotFoundException : API resource location 5ae55b13-c9dd-49d1-957e-6e76c152e3d9 is not registered on https://tfs-test/tfs.
I have attempted to add the collection to the URL and dress it up as much as I can like the REST API call on the MSDN page, but am having no luck. I have noticed that the MSDN page has a section on oauth2, but I have been using a PAT. I cannot find any reference to oauth2 for on-prem TFS 2018, is this not possible?
MSDN - Get User Summary API
For this issue , it is because User Entitlement Summary - Get rest api is only available for VSTS(azure devops), does not support on-premise TFS. TFS APIs currently doesn't support to get access level.
When you switch the rest api version to TFS2018 U2, you will get this prompt:
The requested page is not available for Team Foundation Server 2018
U2. You have been redirected to the newest product version this page
is available for.
You can refer to this case for the similar issue.

TFS 2013 rest api basic authentication is not working

I've tried to get the projects from the TFS on-premise version using below API,
http://tfs2013.ilinktrichy.com:8080/tfs/{organization}/_apis/projects?api-version=1.0
Used the basic authentication and enabled the basic authentication in IIS as well. Still am getting 401 unauthorized issue.
Do i need to do any other changes on IIS?
This is an easy answer, but you're not going to like it.
TFS 2013 did not have REST APIs. They were introduced in TFS 2015.
You can use the old SOAP .NET client for automating tasks against TFS 2013, or (better yet) you can upgrade to a modern version.
update
What I said is not entirely accurate: some of the APIs were present in 2013, but they were not officially introduced until 2015 and are thus largely undocumented and totally unsupported.

TFS 2018 REST API Call for Backlogs // API Version 4.1

we have TFS 2018 and are able to call the following URL using PAT for authorization:
https://our.tfs/tfs/Our.Project.Collection/Our Team Project/_apis/wit/workitems?ids=1234&?api-version=2.0
This quite basic call returns expected results.
Trying to request API calls from the following documentation results always in 404 Page not found:
https://learn.microsoft.com/de-de/rest/api/vsts/work/backlogs/list?view=vsts-rest-4.1
For example:
https://our.tfs/tfs/Our.ProjectCollection/Our Team Project/_apis/work/backlogs?api-version=4.1
which yields the mentioned 404 error.
According Microsoft, the API is supported in version 4.0 on TFS 2018:
https://learn.microsoft.com/en-us/vsts/integrate/concepts/rest-api-versioning?view=tfs-2018
However, it seems calling the API in version 4.1 in the way the documentation describes it here only works for VSTS but not for TFS
Do I understand it correctly that any API calls to API version greater than 4.0 are currently only supported by VSTS but not on TFS on prem?
This would mean we have to live with API calls documented in the "Previous REST API Versions" when using TFS 2018 on prem?
The REST API format you used is incorrect, you missed the Team parameter
The format should be:
GET http://tfs2018:8080/tfs/DefaultCollection/{Project}/{Team}/_apis/work/backlogs?api-version=4.1-preview.1
It works without any issue on my side.
I believe you will get something by taking a look at these links, see
Visual Studio Team Services REST API Reference
REST API Overview for Visual Studio Team Services and Team Foundation Server
I was able to follow this example:
https://{instance}[/{collection}[/{team-project}]/_apis[/{area}]/{resource}?api-version={version}
see what Microsoft speaks about version 4.1 of this doc.
APIs e uso REST comuns
Discussion on TFS MS Apis
Similar discussion
Hugs

Connect TFS 2017 create external TFS connection for TFS 2013

How can I add an external TFS Connection to TFS 2017 to allow it to connect to TFS 2013?
I navigated to http://tfsserver:8080/tfs/collection/team_project_name/_admin/_services?_a=resources and clicked New Service Endpoint. I selected External TFS
When I go to verify the connection after entering all the relevant information, I get the below error.
Failed to query service endpoint api: http://tfsserver:8080/tfs/collection/_apis/projects. Error Message: The remote server returned an error: (401) Unauthorized..
Here is a screenshot of the error.
The odd thing is that if I make a GET request to http://tfsserver:8080/tfs/collection/_apis/projects without any authentication I get a 200 OK response back with project information.
I have configured basic authentication per the tfs cli guide. How can I verify that basic authentication is configured correctly? When I try to login with tfx, I get the following screen.
I have the following extensions installed on the TFS 2017 instance.
Package Management
Release Management Utility tasks
TFS artifacts for Release Management
I am using Microsoft Visual Studio Team Foundation Server Version 15.105.25910.0
According to the screenshot, you are using TFS artifacts for Release Management extension to connect to another TFS instance.
Make sure the things below:
Make sure the collection URL you enter is correct. In your screenshot, the URL you enter is ended with "_home".
Make sure Basic Auth is enabled on TFS server.
Seems you are using the extension TFS artifacts for Release Management which provides a service endpoint to connect to an external TFS or VS Team Services Collection.
After test with TFS2013, I could reproduce your issue and got the same error information. The solution please see below:
Since you are connecting to TFS2013, it works with basic
authentication only. You’ll need to enable basic authentication
support for the TFS Server which handling TFS2013.
Also please make sure the username to connect to the external TFS
collection are with Domain in front of. Then will get a green
verfifed status.

Get Build Definition response body is missing properties

I'm trying to run a request through the TFS REST API v2.0 because I would like to be able to modify the 'ProcessParameters' of a specific BuildDefinition before triggering it. This is so I can pass an argument to the specific BuildDefinition's deployment script.
Doing this work through the TFS SDK works fine, but I've had to refactor to use the REST API instead because this has to run on a production machine without Visual Studio and TFS Team Explorer.
The documentation says I should be able to specify a propertyFilter in my query, but I'm unable to get it to return more information. What I am getting is very light compared to what I'm used to working through the SDK.
Here is my request: https://{instance}/DefaultCollection/{project}/_apis/build/definitions/{id}?api-version=2.0&propertyFilters=processParameters
The response is exactly the same whether or not the "&propertyFilters=processParameters" part is set. It should be able to handle a comma-delimited list of property names but seemingly it is just ignored.
Have I found a bug, or shall we say, a discrepancy between the API documentation and the actual API? Is the 'propertyFilters' query parameter actually implemented? I can't get it to work...
Any help is highly appreciated!
It seems that you are working with XAML build definition as vNext build definition does not have ProcessParameters. However, the RestAPI Build 2.0 is mainly designed for vNext build, it can only get some basic information for XAML build definition. That means, Rest API cannot achieve the features you want for now if you are working with XAML build definition. You have to install VS&Team Explorer and use TFS SDK to do it.