Not Monitored
Tag not monitored by Microsoft.
41,914 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Team,
I am using below code to get the Azure Dev Ops build details from C# code using my Admin PAT, but I am getting 404 not found issue. Can you please help me resolve the issue. Can you also please let me know how do I test the ADO API using postman. Can you also please send me the ADO link where I can find all the working ADO API url.
public string GetBuilds()
{
string sfObjusers = "";
try
{
var personalaccesstoken = "XXXXXXX";
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Add(
new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", "", personalaccesstoken))));
using (HttpResponseMessage response = client.GetAsync("https://dev.azure.com/Digital Commercial/Galaxy_GlobalSales/_apis/build/builds?api-version=5.0").Result)
{
response.EnsureSuccessStatusCode();
var salesForceAccountsTask =
Task.Run(async ()
=> await response.Content.ReadAsStringAsync());
sfObjusers = salesForceAccountsTask.Result;
return sfObjusers;
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
return sfObjusers;
}