Calling Azure DevOps APIs
.NET Client libraries
- Microsoft.VisualStudio.Services.Release.Client
- Microsoft.VisualStudio.Services.Client
API documentation
This is one of the APIs I recently start using.
Authorization
To call those APIs successfully, you have to be authorized. Create a PAT (Personal Access Token) and use it. By default, it uses Basic Auth Scheme. Basic Auth scheme doesn’t provide any security, so it’s used together with HTTPS to secure the traffic
As you use PAT, you wouldn’t have user name when the Basic Auth scheme asks for user name. So, Base64 encode your token like this.
var token = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes($":{_accessToken}"));
request.Headers.Add("Authorization", token);
Then you are good to go and the api request will be successful.
Comments