function crm_core_contact_services_resources in CRM Core 7
Implements hook_services_resources().
File
- modules/
crm_core_contact/ crm_core_contact.module, line 1645 - Provides default CRM Core Contact entities and the ability to create more.
Code
function crm_core_contact_services_resources() {
// @todo Check access to resources.
$resources = array(
'#api_version' => 3002,
'crm_core_contact' => array(
'operations' => array(
'retrieve' => array(
'file' => array(
'type' => 'inc',
'module' => 'crm_core_contact',
'name' => 'includes/crm_core_contact_resource',
),
'callback' => 'crm_core_contact_load',
'args' => array(
array(
'name' => 'contact_id',
'optional' => FALSE,
'source' => array(
'path' => 0,
),
'type' => 'int',
'description' => t('The contact_id of the contact to get.'),
),
),
'access callback' => '_crm_core_contact_resource_access',
'access arguments' => array(
'view',
),
'access arguments append' => TRUE,
),
'create' => array(
'file' => array(
'type' => 'inc',
'module' => 'crm_core_contact',
'name' => 'includes/crm_core_contact_resource',
),
'callback' => '_crm_core_contact_resource_create',
'args' => array(
array(
'name' => 'crm_core_contact',
'optional' => FALSE,
'source' => 'data',
'description' => t('The crm_core_contact data to create.'),
'type' => 'array',
),
),
'access callback' => '_crm_core_contact_resource_access',
'access arguments' => array(
'create',
),
'access arguments append' => TRUE,
),
'update' => array(
'file' => array(
'type' => 'inc',
'module' => 'crm_core_contact',
'name' => 'includes/crm_core_contact_resource',
),
'callback' => '_crm_core_contact_resource_update',
'args' => array(
array(
'name' => 'contact_id',
'optional' => FALSE,
'source' => array(
'path' => 0,
),
'type' => 'int',
'description' => t('The contact_id of the contact to get.'),
),
array(
'name' => 'crm_core_contact',
'optional' => FALSE,
'source' => 'data',
'description' => t('The crm_core_contact data to create.'),
'type' => 'array',
),
),
'access callback' => '_crm_core_contact_resource_access',
'access arguments' => array(
'update',
),
'access arguments append' => TRUE,
),
'delete' => array(
'file' => array(
'type' => 'inc',
'module' => 'crm_core_contact',
'name' => 'includes/crm_core_contact_resource',
),
'callback' => 'crm_core_contact_delete',
'args' => array(
array(
'name' => 'contact_id',
'optional' => FALSE,
'source' => array(
'path' => 0,
),
'type' => 'int',
'description' => t('The contact_id of the contact to delete.'),
),
),
'access callback' => '_crm_core_contact_resource_access',
'access arguments' => array(
'delete',
),
'access arguments append' => TRUE,
),
'index' => array(
'file' => array(
'type' => 'inc',
'module' => 'crm_core_contact',
'name' => 'includes/crm_core_contact_resource',
),
'callback' => '_crm_core_contact_resource_index',
'args' => array(
array(
'name' => 'page',
'optional' => TRUE,
'type' => 'int',
'description' => 'The zero-based index of the page to get, defaults to 0.',
'default value' => 0,
'source' => array(
'param' => 'page',
),
),
array(
'name' => 'pagesize',
'optional' => TRUE,
'type' => 'int',
'description' => 'Number of records to get per page, defaults to 25.',
'default value' => 25,
'source' => array(
'param' => 'pagesize',
),
),
),
'access callback' => '_crm_core_contact_resource_access',
'access arguments' => array(
'view',
),
),
),
),
);
return $resources;
}