title: Using postman to get all pages in a paginated response
body: <pre><code>{
  "users": [...],
  "next_page": "https://junk.example.com/api/v2/users.json?page=2",
  "previous_page": null,
  "count": 1091
  } 
  </code></pre>
  
  <p>The sample above is what I receive in the response body. I am trying to automate postman to pull each page automatically. I have seen documentation about conditional workflows in postman but I can't seem to get it to work. I have used a sample example from <a href="https://stackoverflow.com/questions/45815359/using-postman-to-get-next-iteration?answertab=active#tab-top">this post made last year.</a> But that example doesn't seem to be gelling well with my situation. See attempted test code below.</p>
  
  <pre><code>try {
      var jsonData = pm.response.json();
    //var jsonData = JSON.parse(responseBody);
  
    //The above commented code is my attempt to alter the original example 
    //in the hopes of a solution.
  
    postman.setNextRequest(jsonData.next_page);
  
  } catch (e) {
    console.log('Error parsing JSON', e);
    postman.setNextRequest(null);
  }
  </code></pre>
  
  <p>As you may already can see  have tried to alter it to see if a different method of extracting the next_page object would solve the problem but so far no luck. I receive no error the get request simply doesn't run the next page when I try to do a collection run. </p>