function _file_resource_index in Services 6.3
Same name and namespace in other branches
- 7.3 resources/file_resource.inc \_file_resource_index()
Return an array of optionally paged fids baed on a set of criteria.
An example request might look like
http://domain/endpoint/file?fields=fid,filename¶meters[fid]=7¶me...
This would return an array of objects with only fid and filename defined, where fid = 7 and 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 file objects.
See also
1 string reference to '_file_resource_index'
- _file_resource_definition in resources/
file_resource.inc - THERE SHOULD BE NO UPDATE!!! Drupal doesn't allow updating or replacing a file in the files table. If you need to, create a new file and remove the old file.
File
- resources/
file_resource.inc, line 146 - File resource.
Code
function _file_resource_index($page, $fields, $parameters, $page_size) {
$query = services_resource_build_index_query('files', 'f.timestamp', $page, $fields, $parameters, 'f', 'fid', $page_size, 'file');
// Put together array of matching nodes to return.
$results = array();
while ($comments = db_fetch_object($query)) {
$results[] = $comments;
}
// Put together array of matching files to return.
return services_resource_build_index_list($results, 'files', 'fid');
}