5
votes

Does Azure DevOps REST API has swagger url?

I would like to be able to generate wrapper code in C# or Powershell around it, but cannot find it.

3

3 Answers

3
votes

I am afraid there is not swagger url for azure devops api. Azure DevOps Services .NET SDK is available to integrate with C#.

Here is an example showing how to use Azure DevOps Services .NET SDK.

Here is an example showing how to call Restful api via httpclient.

For powershell You can refer to below example:

$url = "https://dev.azure.com/<...>/MyconsoleApp/_apis/wiki/wikis/MyconsoleApp.wiki/pages?path=/SamplePage123&api-version=5.0"
$connectionToken="xxxxxxxxxxxxxxxxxxxxxxxxx"
$base64AuthInfo= System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($connectionToken)"))
$pipeline = Invoke-RestMethod -Uri $url -Headers @{authorization = "Basic $base64AuthInfo"} -Method Get
10
votes

OpenAPI 2.0 definitions for Azure DevOps Services REST APIs are available in this repository:

https://github.com/MicrosoftDocs/vsts-rest-api-specs

1
votes

You can check out AzurePipelinesPS on the PSGallery it is a PowerShell module that wraps the api.

If you would prefer to write your own wrapper you can check out the rest api documentation.