0
votes

I am using the REST based API for the TFS 2015 to get list of Service Endpoints (as per the reference). But facing an issue while extracting the information.

We have an on prem instance of TFS 2015 (Version 14.102.25423.0). Below is the URL I am trying to get the list of service endpoints.

https://tfs-on-prem-instance/DefaultCollection/product-name/_apis/distributedtask/serviceendpoints?api-version=3.0-preview.1

Error:

In Browser

{"count":1,"value":{"Message":"An error has occurred."}}

In PowerShell

Invoke-RestMethod : {"count":1,"value":{"Message":"An error has occurred."}} At D:\DevOps\TFS\TFSServiceModule.psm1:75 char:23 + ... $result = Invoke-RestMethod -Method Get -Uri $uri -Credential $Cred ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpW ebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell .Commands.InvokeRestMethodCommand

Could anyone let me know how can I fix this? Or refer me to some additional documentation to go through.

2
Do you have access to the server to check the Windows event logs? Also, what is the exact on-premise version you have?DaveShaw
I don't have an access to the server. But I am able to call any other available API like Service Endpoint Types, Get/Create Release definition etc.Ankush Gupta
Version 14.102.25423.0Ankush Gupta

2 Answers

2
votes

You can get the ID of the project via Get a team project rest API first and then use the ID of the project to get the service endpoints via the Service Endpoints API. So the URL should like this:

http://tfsinstance/CollectionName/**PROJECTID**/_apis/distributedtask/serviceendpoints?api-version=3.0-preview.1
1
votes

I've tested with TFS 2015 Update 3 (14.102.25423.0), but also got error when ran the api below:

Get http://tfsserver:8080/tfs/CollectionName/TeamProjectName/_apis/distributedtask/serviceendpoints?api-version=3.0-preview.1

This API works fine on VSTS and TFS 15 RC 2, but doesn't work on TFS 2015.3. I have submitted a feedback at website below, you can vote it:

https://connect.microsoft.com/VisualStudio/feedback/details/3111161