I am trying to call https://dev.azure.com/Digital Commercial/Galaxy_GlobalSales/_apis/build/builds?api-version=5.0 api I am getting 404 not found issue

Veena Karekallahalli Puttegowda 0 Reputation points
2023-07-17T16:47:18.61+00:00

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;
        }


Not Monitored
Not Monitored
Tag not monitored by Microsoft.
41,914 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.