67fadede7a07462b5e25dedd741c532a5745e1a2
3 * Test Generated example demonstrating the Contact.get API.
5 * Get all from group and display contacts.
10 function contact_get_example() {
12 'filter.group_id' => array(
16 'contact_type' => 'Individual',
20 $result = civicrm_api3('Contact', 'get', $params);
22 catch (CiviCRM_API3_Exception
$e) {
24 $errorMessage = $e->getMessage();
25 $errorCode = $e->getErrorCode();
26 $errorData = $e->getExtraParams();
29 'error_message' => $errorMessage,
30 'error_code' => $errorCode,
31 'error_data' => $errorData,
39 * Function returns array of result expected from previous function.
44 function contact_get_expectedresult() {
46 $expectedResult = array(
54 'contact_type' => 'Individual',
55 'contact_sub_type' => '',
56 'sort_name' => 'man2@yahoo.com',
57 'display_name' => 'man2@yahoo.com',
64 'legal_identifier' => '',
65 'external_identifier' => '',
69 'preferred_communication_method' => '',
70 'preferred_language' => 'en_US',
71 'preferred_mail_format' => 'Both',
78 'communication_style_id' => '',
83 'deceased_date' => '',
84 'household_name' => '',
85 'organization_name' => '',
87 'contact_is_deleted' => 0,
88 'current_employer' => '',
90 'street_address' => '1 my road',
91 'supplemental_address_1' => '',
92 'supplemental_address_2' => '',
94 'postal_code_suffix' => '',
98 'state_province_id' => '',
101 'phone_type_id' => '',
104 'email' => 'man2@yahoo.com',
109 'worldregion_id' => '',
110 'world_region' => '',
111 'individual_prefix' => '',
112 'individual_suffix' => '',
113 'communication_style' => '',
115 'state_province_name' => '',
116 'state_province' => '',
123 return $expectedResult;
127 * This example has been generated from the API test suite.
128 * The test that created it is called "testGetGroupIDFromContact"
129 * and can be found at:
130 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
132 * You can see the outcome of the API tests at
133 * https://test.civicrm.org/job/CiviCRM-master-git/
135 * To Learn about the API read
136 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
138 * Browse the api on your own site with the api explorer
139 * http://MYSITE.ORG/path/to/civicrm/api
141 * Read more about testing here
142 * http://wiki.civicrm.org/confluence/display/CRM/Testing
144 * API Standards documentation:
145 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards