title: SharePoint REST API with CAML Query for more than 5000 items
body: <p>I need to filter a list which has more than 5000 items using SharePoint REST API</p>
  
  <p>One of the columns to filter is a managed metadata column which prevents me from using SharePoint REST API GET Urls</p>
  
  <p>I have to use REST API POST requests with CAML Query in the body to achieve this.</p>
  
  <p>My code looks like below</p>
  
  <pre><code>var viewXml =
  {
      ViewXml: "&lt;View&gt;" +
      "&lt;Query&gt;" +
      "&lt;Where&gt;&lt;Eq&gt;" +
      "&lt;FieldRef Name='RegionTestHidden'/&gt;" +
      "&lt;Value Type='TaxonomyFieldType'&gt;" + "North" + "&lt;/Value&gt;" +
      "&lt;/Eq&gt;&lt;/Where&gt;" +
  
      "&lt;/Query&gt;" +
      "&lt;/View&gt;"
  }
  
  function CamlQueryRESTCall(listName, viewXml)
  {
  
      var call = jQuery.ajax(
          {
              url: _spPageContextInfo.webAbsoluteUrl+ "/_api/Web/Lists/getByTitle('"+listName+"')/GetItems(query=@v1)?" +
              "@v1=" + JSON.stringify(viewXml),
              type: "POST",
  
              dataType: "json",
              headers:
              {
                  Accept: "application/json;odata=verbose",
                  "X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
              }
          }
          );
  
      return call;
  
  }
  </code></pre>
  
  <p>The problem I am encountering is if i filter based on region <code>South</code> which has more than 5000 items as result, I am getting <code>HTTP Error 500 Internal Server Error</code> with error message <code>List item threshold exceeded</code>. </p>
  
  <p>With the GET requests I can use <code>$top</code> and <code>data.d.__next</code> to load more than 5000 items. But how to do similar logic in POST requests?</p>
  
  <p>I tried including <code>&lt;RowLimit&gt;1000&lt;/RowLimit&gt;</code> in the CAML Query but still same error</p>
  
  <p>The columns used in query are indexed btw.</p>