You are here

function services_resource_uri in Services 7.3

Same name and namespace in other branches
  1. 6.3 services.runtime.inc \services_resource_uri()
  2. 6.2 services.module \services_resource_uri()
  3. 7 services.module \services_resource_uri()

Formats a resource uri using the formatter registered through services_set_server_info().

Parameters

array $path: An array of strings containing the component parts of the path to the resource.

Return value

string Returns the formatted resource uri, or NULL if no formatter has been registered.

9 calls to services_resource_uri()
services_resource_build_index_list in ./services.module
Helper function to build a list of items satisfying the index query.
taxonomy_service_select_nodes in resources/taxonomy_resource.inc
Services interface to taxonomy_select_nodes().
_comment_resource_create in resources/comment_resource.inc
Adds a new comment to a node and returns the cid.
_file_resource_create in resources/file_resource.inc
Adds a new file and returns the fid.
_file_resource_create_raw in resources/file_resource.inc
Adds new files and returns the files array.

... See full list

File

includes/services.runtime.inc, line 282
Contains functions that only are necessary when a service call is made. This has broken out so that this code isn't loaded for every page load.

Code

function services_resource_uri($path) {
  $endpoint_name = services_get_server_info('endpoint');
  $endpoint = services_endpoint_load($endpoint_name);
  if (!empty($path[0]) && !empty($endpoint->resources[$path[0]]['alias'])) {
    $path[0] = $endpoint->resources[$path[0]]['alias'];
  }
  $formatter = services_get_server_info('resource_uri_formatter');
  if ($formatter) {
    return call_user_func($formatter, $path);
  }
  return NULL;
}