- // Get by id
- $caseId = CRM_Utils_Array::value('id', $params);
- if ($caseId) {
- // Validate param
- if (!is_numeric($caseId)) {
- return civicrm_api3_create_error('Invalid parameter: case_id. Must provide a numeric value.');
- }
- // For historic reasons we always return these when an id is provided
- $options['return'] = array('contacts' => 1, 'activities' => 1);
- $case = _civicrm_api3_case_read($caseId, $options);
-
- if ($case) {
- return civicrm_api3_create_success(array($caseId => $case), $params, 'case', 'get');
- }
- else {
- return civicrm_api3_create_success(array(), $params, 'case', 'get');
- }
- }
-