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' => '55',
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' => '',
120 'postal_code_suffix' => '',
124 'state_province_id' => '',
127 'phone_type_id' => '',
130 'email' => 'anthony_anderson@civicrm.org',
135 'worldregion_id' => '',
136 'world_region' => '',
137 'individual_prefix' => 'Mr.',
138 'individual_suffix' => 'II',
139 'communication_style' => '',
141 'state_province_name' => '',
142 'state_province' => '',
152 return $expectedResult;
156 * This example has been generated from the API test suite.
157 * The test that created it is called "testActivityGetGoodID1"
158 * and can be found at:
159 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
161 * You can see the outcome of the API tests at
162 * https://test.civicrm.org/job/CiviCRM-master-git/
164 * To Learn about the API read
165 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
167 * Browse the api on your own site with the api explorer
168 * http://MYSITE.ORG/path/to/civicrm/api
170 * Read more about testing here
171 * http://wiki.civicrm.org/confluence/display/CRM/Testing
173 * API Standards documentation:
174 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards