You are here

function _taxonomy_term_resource_index in Services 6.3

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

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

An example request might look like

http://domain/endpoint/taxonomy_term?fields=tid,name&parameters[tid]=7&p...

This would return an array of objects with only tid and name defined, where tid = 7 and vid = 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 term objects.

See also

_node_resource_index()

1 string reference to '_taxonomy_term_resource_index'
_taxonomy_resource_definition in resources/taxonomy_resource.inc
@file Link general taxonomy functionalities to services module.

File

resources/taxonomy_resource.inc, line 358
Link general taxonomy functionalities to services module.

Code

function _taxonomy_term_resource_index($page, $fields, $parameters, $page_size) {
  $query = services_resource_build_index_query('term_data', 't.vid DESC, t.weight DESC, t.name DESC', $page, $fields, $parameters, 't', 'tid', $page_size, 'taxonomy_term');
  $results = array();
  while ($taxonomy = db_fetch_object($query)) {
    $results[] = $taxonomy;
  }
  return services_resource_build_index_list($results, 'taxonomy_term', 'tid');
}