Microsoft TFS Rest API for repository list does not return ssh URLs - rest

TFS server version: 2017
Compatible API version <= 3.0
The Rest API endpoint to fetch the information for tfs-git repositories is mentioned here:
[https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/list?view=azure-devops-rest-4.1]
This returns the HTTP clone links for the repositories but not the ssh URL. Also, the documentation does not mention any API option to get the same.
Is there for API not including the ssh URLs?
Again, this isn't visual studio but TFS server.

Are sure this is the case, as if I call.
https://dev.azure.com/PeterLai0838/_apis/git/repositories?api-version=5.1
i get
"remoteUrl":"https://PeterLai0838#dev.azure.com/PeterLai0838/roboops/_git/roboops",
"sshUrl":"git#ssh.dev.azure.com:v3/PeterLai0838/roboops/roboops",
"webUrl":"https://dev.azure.com/PeterLai0838/roboops/_git/roboops"}]
Ah wait, i notice your using the 4.1 api, maybe use the 5.1?

sshURL is supported in TFS 2018 and later. You may submit a feature request at website below:
https://developercommunity.visualstudio.com/content/idea/post.html?space=22

Related

Azure DevOps API Create Project TF400734 (OnPrem)

Is there a suggested way to call Projects - Create on a self hosted Azure DevOps Server?
If I use the API on OnPrem self hosted server, I get:
TF400734: This service is only available with hosted Azure DevOps.
but my requirement, to create a new project over API, still exist.
What I try?
When I drag the network traffic on manual project creation I get a bunch of items that I can't handle:
Only the first event projects is a readable post request to:
https://myserverurl.com/MyCollection/_apis/projects
Payload:
id: "b87a57c9-6a50-415a-8da5-869499c02b0a"
status: 0
url: "https://myserverurl.com/MyCollection/_apis/operations/b87a57c9-6a50-415a-8da5-869499c02b0a"
There isn't any event that contains the passed project name and description.
Currently, the REST API 6.0 version is only supported on Azure DevOps Services (VSTS), not Azure DevOps Server (TFS).
And currently the highest REST API version that can be supported on TFS is 5.0. Generally, the lower TFS version corresponds the lower API version. To view more details, you can see "API and TFS version mapping".
So, for your case, if your TFS version is 2019 or 2020, you can try the REST API 5.0 version. To create a project, you can try this.
POST https://{instance}/{collection}/_apis/projects?api-version=5.0

How to identify the latest stable REST API version of Azure DevOps Services?

In my project, there is a requirement to create Azure artifacts feed automatically.
For this I used REST API mentioned in this doc: https://learn.microsoft.com/en-us/rest/api/azure/devops/artifacts/feed%20%20management/create%20feed?view=azure-devops-rest-5.0
and used python to create feed.
POST https://feeds.dev.azure.com/{organization}/_apis/packaging/feeds?api-version=5.0-preview.1
It worked fine.
Later I saw that a new version of API was available.
It is not easy to change the code every time there is a new API version.
So the question is how to identify/use the latest stable working version of API always?
Sorry, there wasn't a hint if there is a new Rest API version released. But just like Matt commented, the old version will not stop working in general. It's quite stable.
Azure DevOps and Team Foundation Server REST APIs are versioned to ensure applications and services continue to work as APIs evolve.
Major API version releases align with Team Foundation Server RTM releases. For example, the 3.0 API set was introduced with Team Foundation Server 2017.
You'll find a quick mapping of REST API versions and their corresponding TFS releases here. All API versions will work on the server version mentioned as well as later versions.
Unlike Azure DevOps Server/TFS, if you are working on Azure DevOps Service, you do not have to pay too much attention which version you are using. It's supported on 1.0~6.0.
Hope it is clearly.

Get Branching Model in bitbucket server via REST

Someone knows how I can GET the PROJECT's branching model via REST API. Not the repository. I can not find how to do it anywhere.
In bitbucket server I find it via web at https://mybitbucket.com/plugins/servlet/branchmodel/projects/{project-key}
I found it:
Is not in the actual version of REST API Documentation
(https://docs.atlassian.com/bitbucket-server/rest/5.14.0/bitbucket-rest.html)
Then, you can do GET request to:
https://mybitbucket.com/rest/branch-utils/1.0/projects/{project-key}/branchmodel/configuration

Getting profile information from tfs REST API showing Page not found

Am sure this might have been asked before.I have searched like anything not getting any information thats why i thought of posting here. any help is appreciated
https://app.vssps.visualstudio.com/_apis/profile/profiles/me?api-version=1.0
this REST API always giving Page not found tfs2015 server using.
The REST API you mentioned is for VSTS :
https://app.vssps.visualstudio.com/_apis/profile/profiles/me?api-version=1.0
For on-premise TFS (TFS 2015 in your case), you can use below REST API to get the profile information (connect to TFS first):
http://server:8080/tfs/_api/_common/GetUserProfile?__v=5

Get current project version of repository Github

From this question I would like to know if there's a way to check current version of a repo directly from the website (without Git command line). I need this for a web scraping bot.
By using the REST API, you can get the latest release at:
https://api.github.com/repos/$org/$repo/releases/latest