3 * Test Generated example demonstrating the Contact.get API.
5 * Get all from group and display contacts.
10 function contact_get_example() {
14 '0' => 'Test group C',
15 '1' => 'Test group D',
21 $result = civicrm_api3('Contact', '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 contact_get_expectedresult() {
47 $expectedResult = array(
55 'contact_type' => 'Individual',
56 'contact_sub_type' => '',
57 'sort_name' => 'Groupmember, Test2',
58 'display_name' => 'Test2 Groupmember',
65 'legal_identifier' => '',
66 'external_identifier' => '',
70 'preferred_communication_method' => '',
71 'preferred_language' => 'en_US',
72 'preferred_mail_format' => 'Both',
73 'first_name' => 'Test2',
75 'last_name' => 'Groupmember',
79 'communication_style_id' => '',
84 'deceased_date' => '',
85 'household_name' => '',
86 'organization_name' => '',
88 'contact_is_deleted' => 0,
89 'current_employer' => '',
91 'street_address' => '',
92 'supplemental_address_1' => '',
93 'supplemental_address_2' => '',
94 'supplemental_address_3' => '',
96 'postal_code_suffix' => '',
100 'state_province_id' => '',
103 'phone_type_id' => '',
106 'email' => 'test@example.org',
111 'worldregion_id' => '',
112 'world_region' => '',
113 'languages' => 'English (United States)',
114 'individual_prefix' => '',
115 'individual_suffix' => '',
116 'communication_style' => '',
118 'state_province_name' => '',
119 'state_province' => '',
126 return $expectedResult;
130 * This example has been generated from the API test suite.
131 * The test that created it is called "testContactGetWithGroupTitleMultipleGroups"
132 * and can be found at:
133 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
135 * You can see the outcome of the API tests at
136 * https://test.civicrm.org/job/CiviCRM-master-git/
138 * To Learn about the API read
139 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
141 * Browse the api on your own site with the api explorer
142 * http://MYSITE.ORG/path/to/civicrm/api
144 * Read more about testing here
145 * http://wiki.civicrm.org/confluence/display/CRM/Testing
147 * API Standards documentation:
148 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards