3 * Test Generated example of using contact get API
6 function contact_get_example(){
8 'email' => 'man2@yahoo.com',
12 $result = civicrm_api3('contact', 'get', $params);
14 catch (CiviCRM_API3_Exception
$e) {
16 $errorMessage = $e->getMessage();
17 $errorCode = $e->getErrorCode();
18 $errorData = $e->getExtraParams();
19 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
26 * Function returns array of result expected from previous function
28 function contact_get_expectedresult(){
30 $expectedResult = array(
38 'contact_type' => 'Individual',
39 'contact_sub_type' => '',
40 'sort_name' => 'man2@yahoo.com',
41 'display_name' => 'man2@yahoo.com',
48 'legal_identifier' => '',
49 'external_identifier' => '',
53 'preferred_communication_method' => '',
54 'preferred_language' => 'en_US',
55 'preferred_mail_format' => 'Both',
62 'communication_style_id' => '',
67 'deceased_date' => '',
68 'household_name' => '',
69 'organization_name' => '',
71 'contact_is_deleted' => 0,
72 'current_employer' => '',
74 'street_address' => '1 my road',
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' => '',
97 'communication_style' => '',
99 'state_province_name' => '',
100 'state_province' => '',
107 return $expectedResult;
112 * This example has been generated from the API test suite. The test that created it is called
114 * testContactGetEmail and can be found in
115 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
117 * You can see the outcome of the API tests at
118 * https://test.civicrm.org/job/CiviCRM-master-git/
120 * To Learn about the API read
121 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
123 * Browse the api on your own site with the api explorer
124 * http://MYSITE.ORG/path/to/civicrm/api/explorer
126 * Read more about testing here
127 * http://wiki.civicrm.org/confluence/display/CRM/Testing
129 * API Standards documentation:
130 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards