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