3 * Test Generated example of using contact get API
4 * Get all from group and display contacts *
6 function contact_get_example(){
8 'filter.group_id' => array(
12 'contact_type' => 'Individual',
16 $result = civicrm_api3('contact', 'get', $params);
18 catch (CiviCRM_API3_Exception
$e) {
20 $errorMessage = $e->getMessage();
21 $errorCode = $e->getErrorCode();
22 $errorData = $e->getExtraParams();
23 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
30 * Function returns array of result expected from previous function
32 function contact_get_expectedresult(){
34 $expectedResult = array(
42 'contact_type' => 'Individual',
43 'contact_sub_type' => '',
44 'sort_name' => 'man2@yahoo.com',
45 'display_name' => 'man2@yahoo.com',
52 'legal_identifier' => '',
53 'external_identifier' => '',
57 'preferred_communication_method' => '',
58 'preferred_language' => 'en_US',
59 'preferred_mail_format' => 'Both',
66 'communication_style_id' => '',
71 'deceased_date' => '',
72 'household_name' => '',
73 'organization_name' => '',
75 'contact_is_deleted' => 0,
76 'current_employer' => '',
78 'street_address' => '1 my road',
79 'supplemental_address_1' => '',
80 'supplemental_address_2' => '',
82 'postal_code_suffix' => '',
86 'state_province_id' => '',
89 'phone_type_id' => '',
92 'email' => 'man2@yahoo.com',
97 'worldregion_id' => '',
99 'individual_prefix' => '',
100 'individual_suffix' => '',
101 'communication_style' => '',
103 'state_province_name' => '',
104 'state_province' => '',
111 return $expectedResult;
116 * This example has been generated from the API test suite. The test that created it is called
118 * testGetGroupIDFromContact and can be found in
119 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
121 * You can see the outcome of the API tests at
122 * https://test.civicrm.org/job/CiviCRM-master-git/
124 * To Learn about the API read
125 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
127 * Browse the api on your own site with the api explorer
128 * http://MYSITE.ORG/path/to/civicrm/api/explorer
130 * Read more about testing here
131 * http://wiki.civicrm.org/confluence/display/CRM/Testing
133 * API Standards documentation:
134 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards