You are here

function _user_resource_index in Services 6.3

Same name and namespace in other branches
  1. 7.3 resources/user_resource.inc \_user_resource_index()

Return an array of optionally paged nids baed on a set of criteria.

An example request might look like

http://domain/endpoint/user?fields=uid,name,mail&parameters[uid]=1

This would return an array of objects with only uid, name and mail defined, where uid = 1.

Parameters

$page: Page number of results to return (in pages of 20).

$fields: The fields you want returned.

$parameters: An array containing fields and values used to build a sql WHERE clause indicating items to retrieve.

$page_size: Integer number of items to be returned.

Return value

An array of user objects.

See also

_node_resource_index()

1 string reference to '_user_resource_index'
_user_resource_definition in resources/user_resource.inc
@file This file will define the resources for dealing with the user object

File

resources/user_resource.inc, line 452
This file will define the resources for dealing with the user object

Code

function _user_resource_index($page, $fields, $parameters, $page_size) {
  if (!user_access('administer users')) {
    $parameters['status'] = 1;
  }
  $query = services_resource_build_index_query('users', 'u.created DESC', $page, $fields, $parameters, 'u', 'uid', $page_size, 'user');
  $results = array();
  while ($user = db_fetch_object($query)) {
    $results[] = $user;
  }
  return services_resource_build_index_list($results, 'user', 'uid');
}