I am trying to get all tasks from Azure DevOps. I try to follow this documentation: https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/?view=azure-devops-rest-5.0#a-flat-query
I am using this snippet to do requests:
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 = await client.GetAsync(url))
{
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
JToken parsedJson = JToken.Parse(json);
return parsedJson.ToString(Formatting.Indented);
}
}
As I understand it you cannot just get all tasks. First step is to get the ID's for all tasks and that needs to be done with a WIQL query. Correct me if I am wrong.
So I try to call following to to get some data for a start: https://dev.azure.com/xxxprod/XXX/XXX Team/_apis/wit/wiql?$top=100&api-version=5.0
However I get a 405 not allowed and I can call other calls like: https://dev.azure.com/xxxprod/_apis/projects
Can anyone provide sample or instruction on how to get all tasks via the REST api?