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_mail_format' => 'Both',
67 'deceased_date' => '',
68 'household_name' => '',
69 'organization_name' => '',
71 'contact_is_deleted' => 0,
72 'current_employer' => '',
74 'street_address' => '',
75 'supplemental_address_1' => '',
76 'supplemental_address_2' => '',
78 'postal_code_suffix' => '',
82 'state_province_id' => '',
85 'phone_type_id' => '',
88 'email' => 'man2@yahoo.com',
93 'worldregion_id' => '',
95 'individual_prefix' => '',
96 'individual_suffix' => '',
98 'state_province_name' => '',
99 'state_province' => '',
106 return $expectedResult;
111 * This example has been generated from the API test suite. The test that created it is called
113 * testGetGroupIDFromContact and can be found in
114 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
116 * You can see the outcome of the API tests at
117 * http://tests.dev.civicrm.org/trunk/results-api_v3
119 * To Learn about the API read
120 * http://book.civicrm.org/developer/current/techniques/api/
122 * and review the wiki at
123 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
125 * Read more about testing here
126 * http://wiki.civicrm.org/confluence/display/CRM/Testing
128 * API Standards documentation:
129 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards