index

DrMiaow's picture

Took me hours to locate this information.

If you want to use the 'index' operation in services, it takes only three parameters

page (the page number)
fields (the fields to include).
parameters (the actual parameters) - these are passed directly into the query, so these need to be node record field names.

eg:

/api/test/rest/node?fields=nid,title&parameters[type]=playlist&page=1

Comments

Hello, have a look at

bst2002's picture

Hello,
have a look at services/resources/, in your case node_resource.inc and search for "function _node_resource_index" read description above, you can find other usefull doc in the resource files ;-)

Cheers

Thanks!

DrMiaow's picture

/**
* Return an array of optionally paged nids baed on a set of criteria.
*
* An example request might look like
*
* http://domain/endpoint/node?fields=nid,vid&parameters[nid]=7&parameters[uid]=1
*
* This would return an array of objects with only nid and vid defined, where
* nid = 7 and uid = 1.
*
* @param $page
* Page number of results to return (in pages of 20).
* @param $fields
* The fields you want returned.
* @param $parameters
* An array containing fields and values used to build a sql WHERE clause
* indicating items to retrieve.
* @param $page_size
* Integer number of items to be returned.
* @return
* An array of node objects.
*
* @todo
* Evaluate the functionality here in general. Particularly around
* - Do we need fields at all? Should this just return full nodes?
* - Is there an easier syntax we can define which can make the urls
* for index requests more straightforward?
*/

Services

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week