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

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.

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

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

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

Nexus - List Artifacts from repository

Is there any way to list artifact in Nexus v3.0, other that using rest API?
As the rest API for this version have not been implemented yet.
At this time, the REST API has been released as beta. You can get more information and give us feedback by going to this link: http://blog.sonatype.com/nexus-repository-new-beta-rest-api-for-content
It should address this use case, as well!

Jira integration with Octopus deploy

I am new to Octopus deploy but what I am after is a way to get the jira ticket numbers into the release notes in octopus deploy. I would like to know the fixes/features related to the build number.
I have written a Powershell step for TeamCity that queries the JIRA API to get all issues with the Fixed In version equivalent to the version number that TeamCity is building, and then querying the JIRA API again to get the issue details so that I can then build the release notes in Markdown, which then gets passed into Octopack to embed in the Nuget package. Then when I go into Octopus, I can see all the included ticket numbers and summaries, grouped by issue type (bug fix, new feature, improvement etc).
Given that it is very straightforward to create an Octopus step using Powershell, and the ease of use of the JIRA API, you ought to be able to do something similar from Octopus, but if possible, I would recommend making it part of your build process rather than your deployment process.

Do nuget feeds follow a defined standard?

My understanding is that the nuget CLI and visual studio itself work not only with the offical nuget.org feed but with other feeds from third party sites like myget.
Does this mean that the feeds themselves follow a defined standard, so the tools can work with any feeds?
If so where can I find this standard?
I am also confused about the difference between the v2 and v3 nuget.org feeds.
Update
I now understand that there are two versions of the official nuget feeds, v2 which is OData based and v3 which is a rest api. I also understand that the nuget cli and visual studio are able to talk to both.
What I still don't understand is that if you look at this post https://docs.nuget.org/create/hosting-your-own-nuget-feeds, it states
There are several third-party NuGet Servers available that make remote
private feeds easy to configure and set-up, including Visual Studio
Team Services, MyGet, Inedo's ProGet, JFrog's Artifactory, NuGet
Server, and Sonatype's Nexus. See An Overview of the NuGet Ecosystem
to learn more about these options.
For both the nuget cli and visual studio to be able to work with all these various thirdparty feeds, surely there must be some underlying common standard feed format. Are they all use the same OData format as v2 for instance? This is the crux of my question.
NuGet v2 provides an OData feed.
NuGet v3 provides a restful API uses a few different protocols, one of which I believe is based on JSON-LD.
There is some information in the Building NuGet 3.x post about this.
There is also some more information about the NuGet v3 API in another StackOverflow post
What NuGet API third party servers support is up to the third party server. VSTS for example supports both NuGet v2 and NuGet v3 APIs each of which have a different url. Team City for example implements the NuGet v1 API. ProGet at the time of writing supports NuGet v2.
The NuGet client itself hides these differences from you unless you use some of the lower level classes. The NuGet client itself has a simple check that if the url ends with index.json then it is a NuGet v3 feed and uses a different set of classes to connect to the server. Otherwise it uses a NuGet v2 set of classes to connect to the server.
The feed organization is based on a set of APIs, clients that manipulate the feed (e.g.,
nuget.exe) use these API to manage the feed.
Here is a description for a NuGet v3 feed: https://learn.microsoft.com/en-us/nuget/api/overview