Drupal 7 + Services: Paging & Filtering the index endpoint

There are a lot of ways to manipulate the data returned by the index endpoint. In this post, we are going to consider the node index endpoint. By default, this endpoint returns all nodes sorted in descending order of last update with 20 items per page.

You access the node index endpoint by going to

http://<domain>/<endpoint-path/node.json (or the alias given to node in the resources section)

You can replace .json with with other extensions to get the same data in different formats

To access the second page, you can use the page parameter



To change the number of items on each page, you need the "perform unlimited index" queries permission. You use the pagesize parameter to change it

To filter a field, you can use the parameters[property] where ‘property’ is the field on which you want to filter. It needs to be a field on the node table, and not a drupal field as it does not do the joins to pull in field data.



To apply a different filter than of equality, you can use options[parameters_op][property] where property is the same as above.



To return fewer fields, you can use fields and comma separate the properties. Once again, you can only specify properties on the entity (i.e fields on the base table)



you can sort the results by using options[orderby][property]=<asc|desc>



You can also mix and match these separate options


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s