3 * Test Generated example demonstrating the Activity.get API.
5 * Demonstrates getting assignee_contact_id & using it to get the contact.
10 function activity_get_example() {
14 'return.assignee_contact_id' => 1,
15 'api.contact.get' => array(
16 'id' => '$value.source_contact_id',
21 $result = civicrm_api3('Activity', 'get', $params);
23 catch (CiviCRM_API3_Exception
$e) {
25 $errorMessage = $e->getMessage();
26 $errorCode = $e->getErrorCode();
27 $errorData = $e->getExtraParams();
30 'error_message' => $errorMessage,
31 'error_code' => $errorCode,
32 'error_data' => $errorData,
40 * Function returns array of result expected from previous function.
45 function activity_get_expectedresult() {
47 $expectedResult = array(
55 'activity_type_id' => '9999',
56 'subject' => 'test activity type id',
57 'activity_date_time' => '2011-06-02 14:36:13',
59 'location' => 'Pennsylvania',
60 'details' => 'a test activity',
65 'is_current_revision' => '1',
68 'assignee_contact_id' => array(
71 'source_contact_id' => '1',
72 'api.contact.get' => array(
80 'contact_type' => 'Individual',
81 'contact_sub_type' => '',
82 'sort_name' => 'Anderson, Anthony',
83 'display_name' => 'Mr. Anthony Anderson II',
90 'legal_identifier' => '',
91 'external_identifier' => '',
95 'preferred_communication_method' => '',
96 'preferred_language' => 'en_US',
97 'preferred_mail_format' => 'Both',
98 'first_name' => 'Anthony',
99 'middle_name' => 'J.',
100 'last_name' => 'Anderson',
103 'formal_title' => '',
104 'communication_style_id' => '',
109 'deceased_date' => '',
110 'household_name' => '',
111 'organization_name' => '',
113 'contact_is_deleted' => 0,
114 'current_employer' => '',
116 'street_address' => '',
117 'supplemental_address_1' => '',
118 'supplemental_address_2' => '',
119 'supplemental_address_3' => '',
121 'postal_code_suffix' => '',
125 'state_province_id' => '',
128 'phone_type_id' => '',
131 'email' => 'anthony_anderson@civicrm.org',
136 'worldregion_id' => '',
137 'world_region' => '',
138 'languages' => 'English (United States)',
139 'individual_prefix' => 'Mr.',
140 'individual_suffix' => 'II',
141 'communication_style' => '',
143 'state_province_name' => '',
144 'state_province' => '',
154 return $expectedResult;
158 * This example has been generated from the API test suite.
159 * The test that created it is called "testActivityGetGoodID1"
160 * and can be found at:
161 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
163 * You can see the outcome of the API tests at
164 * https://test.civicrm.org/job/CiviCRM-master-git/
166 * To Learn about the API read
167 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
169 * Browse the api on your own site with the api explorer
170 * http://MYSITE.ORG/path/to/civicrm/api
172 * Read more about testing here
173 * http://wiki.civicrm.org/confluence/display/CRM/Testing
175 * API Standards documentation:
176 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards