3

I'm looking for a way to get all the nodes to be shown on my REST service. When I query the endpoint index http://server/api/node it only returns 20 results. Are there any additional parameters I can send along to unset this limit?

I would be really thankful for a quick answer. I have been spending a couple of days now to get the REST service in Drupal to work the way I need it to work.

P.S. I'm on Drupal 7

1 Answer 1

7

The index actually sends 20 results per page. I highly recommend you check out the ServicesResourceNodeTests.test file in the services module for a better explaination but basically you can pass the page number you want to get each page of results.

The test file shows how it checks to see if the next page is empty:

// The n+1 page should be empty.
    $responseArray = $this->servicesGet($this->endpoint->path . '/node', array('page' => $page_count + 1));
    $this->assertEqual(count($responseArray['body']), 0, t('The n+1 page is empty'));

Another (my preferred) option would be to use the Services Views module instead and that way you can get all the nodes in whatever format you wish!

1
  • Thank you @7wonders! Got it working now. Passing the extra "pagesize" parameter made the trick. Commented Oct 23, 2012 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.