title: Get all work items from devops throug rest api
body: <p>According to documentation you can get work items as following:</p>
  
  <pre><code>GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems?ids={ids}&amp;api-version=5.1
  </code></pre>
  
  <p>However you need to provide ids for all the workitems you want. What if you just want all workitems? If I skip Ids I get following:</p>
  
  <blockquote>
    <p>Response status code does not indicate success: 404 (Not Found).</p>
  </blockquote>
  
  <hr>
  
  <p>OK I am getting a little closer thanks to some of the repsonses:</p>
  
  <pre><code>var uri = "https://dev.azure.com/xx"; 
  var personalAccessToken = "xx";
  var project = "GAC";
  
  VssBasicCredential credentials = new VssBasicCredential("", personalAccessToken);
  
  Wiql wiql = new Wiql()
  {
      Query = "Select [State], [Title],[Remaining Work] From WorkItems Where [Work Item Type] = 'Bug' OR [Work Item Type] = 'Task' And [System.TeamProject] = '" + project+"'"
  };
  
  //create instance of work item tracking http client
  using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(new Uri(uri), credentials))
  {
      //execute the query to get the list of work items in the results
      WorkItemQueryResult workItemQueryResult = workItemTrackingHttpClient.QueryByWiqlAsync(wiql).Result;
  
      //some error handling                
      if (workItemQueryResult.WorkItems.Count() != 0)
      {
          foreach (IEnumerable&lt;WorkItemReference&gt; batch in workItemQueryResult.WorkItems.Batch(100))
          {
              var workItemIds = batch.Select(p =&gt; p.Id).ToArray();
              var workItems = workItemTrackingHttpClient.GetWorkItemsAsync(workItemIds, expand: WorkItemExpand.All).Result;
          }                   
      }              
  }
  </code></pre>
  
  <p>However I dont get information around what I am primary looking for like Completed, Remaining works etc. Any pointers?</p>