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();
29 'error' => $errorMessage,
30 'error_code' => $errorCode,
31 'error_data' => $errorData,
39 * Function returns array of result expected from previous function.
44 function activity_get_expectedresult() {
46 $expectedResult = array(
54 'activity_type_id' => '51',
55 'subject' => 'test activity type id',
56 'activity_date_time' => '2011-06-02 14:36:13',
58 'location' => 'Pennsylvania',
59 'details' => 'a test activity',
64 'is_current_revision' => '1',
66 'assignee_contact_id' => array(
69 'source_contact_id' => '1',
70 'api.contact.get' => array(
78 'contact_type' => 'Individual',
79 'contact_sub_type' => '',
80 'sort_name' => 'Anderson, Anthony',
81 'display_name' => 'Mr. Anthony Anderson II',
88 'legal_identifier' => '',
89 'external_identifier' => '',
93 'preferred_communication_method' => '',
94 'preferred_language' => 'en_US',
95 'preferred_mail_format' => 'Both',
96 'first_name' => 'Anthony',
97 'middle_name' => 'J.',
98 'last_name' => 'Anderson',
101 'formal_title' => '',
102 'communication_style_id' => '',
107 'deceased_date' => '',
108 'household_name' => '',
109 'organization_name' => '',
111 'contact_is_deleted' => 0,
112 'current_employer' => '',
114 'street_address' => '',
115 'supplemental_address_1' => '',
116 'supplemental_address_2' => '',
118 'postal_code_suffix' => '',
122 'state_province_id' => '',
125 'phone_type_id' => '',
128 'email' => 'anthony_anderson@civicrm.org',
133 'worldregion_id' => '',
134 'world_region' => '',
135 'individual_prefix' => 'Mr.',
136 'individual_suffix' => 'II',
137 'communication_style' => '',
139 'state_province_name' => '',
140 'state_province' => '',
150 return $expectedResult;
154 * This example has been generated from the API test suite.
155 * The test that created it is called "testActivityGetGoodID1"
156 * and can be found at:
157 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
159 * You can see the outcome of the API tests at
160 * https://test.civicrm.org/job/CiviCRM-master-git/
162 * To Learn about the API read
163 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
165 * Browse the api on your own site with the api explorer
166 * http://MYSITE.ORG/path/to/civicrm/api
168 * Read more about testing here
169 * http://wiki.civicrm.org/confluence/display/CRM/Testing
171 * API Standards documentation:
172 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards