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',
69 'deceased_date' => '',
70 'household_name' => '',
71 'organization_name' => '',
73 'contact_is_deleted' => 0,
74 'current_employer' => '',
76 'street_address' => '1 my road',
77 'supplemental_address_1' => '',
78 'supplemental_address_2' => '',
80 'postal_code_suffix' => '',
84 'state_province_id' => '',
87 'phone_type_id' => '',
90 'email' => 'man2@yahoo.com',
95 'worldregion_id' => '',
97 'individual_prefix' => '',
98 'individual_suffix' => '',
100 'state_province_name' => '',
101 'state_province' => '',
108 return $expectedResult;
113 * This example has been generated from the API test suite. The test that created it is called
115 * testGetGroupIDFromContact and can be found in
116 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
118 * You can see the outcome of the API tests at
119 * https://test.civicrm.org/job/CiviCRM-master-git/
121 * To Learn about the API read
122 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
124 * Browse the api on your own site with the api explorer
125 * http://MYSITE.ORG/path/to/civicrm/api/explorer
127 * Read more about testing here
128 * http://wiki.civicrm.org/confluence/display/CRM/Testing
130 * API Standards documentation:
131 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards