3 * Test Generated example of using activity get API
4 * Function demonstrates getting asignee_contact_id & using it to get the contact *
6 function activity_get_example(){
10 'return.assignee_contact_id' => 1,
11 'api.contact.get' => array(
12 'id' => '$value.source_contact_id',
17 $result = civicrm_api3('activity', 'get', $params);
19 catch (CiviCRM_API3_Exception
$e) {
21 $errorMessage = $e->getMessage();
22 $errorCode = $e->getErrorCode();
23 $errorData = $e->getExtraParams();
24 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
31 * Function returns array of result expected from previous function
33 function activity_get_expectedresult(){
35 $expectedResult = array(
43 'activity_type_id' => '46',
44 'subject' => 'test activity type id',
45 'activity_date_time' => '2011-06-02 14:36:13',
47 'location' => 'Pensulvania',
48 'details' => 'a test activity',
53 'is_current_revision' => '1',
55 'assignee_contact_id' => array(
58 'source_contact_id' => '1',
59 'api.contact.get' => array(
67 'contact_type' => 'Individual',
68 'contact_sub_type' => '',
69 'sort_name' => 'Anderson, Anthony',
70 'display_name' => 'Mr. Anthony Anderson II',
77 'legal_identifier' => '',
78 'external_identifier' => '',
82 'preferred_communication_method' => '',
83 'preferred_language' => 'en_US',
84 'preferred_mail_format' => 'Both',
85 'first_name' => 'Anthony',
86 'middle_name' => 'J.',
87 'last_name' => 'Anderson',
94 'deceased_date' => '',
95 'household_name' => '',
96 'organization_name' => '',
98 'contact_is_deleted' => 0,
99 'current_employer' => '',
101 'street_address' => '',
102 'supplemental_address_1' => '',
103 'supplemental_address_2' => '',
105 'postal_code_suffix' => '',
109 'state_province_id' => '',
112 'phone_type_id' => '',
115 'email' => 'anthony_anderson@civicrm.org',
120 'worldregion_id' => '',
121 'world_region' => '',
122 'individual_prefix' => 'Mr.',
123 'individual_suffix' => 'II',
125 'state_province_name' => '',
126 'state_province' => '',
136 return $expectedResult;
141 * This example has been generated from the API test suite. The test that created it is called
143 * testActivityGetGoodID1 and can be found in
144 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
146 * You can see the outcome of the API tests at
147 * https://test.civicrm.org/job/CiviCRM-master-git/
149 * To Learn about the API read
150 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
152 * Browse the api on your own site with the api explorer
153 * http://MYSITE.ORG/path/to/civicrm/api/explorer
155 * Read more about testing here
156 * http://wiki.civicrm.org/confluence/display/CRM/Testing
158 * API Standards documentation:
159 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards