4 * Test Generated API Example.
5 * See bottom of this file for more detail.
9 * Test Generated example of using contact get API.
15 function contact_get_example() {
17 'email' => 'man2@yahoo.com',
21 $result = civicrm_api3('contact', 'get', $params);
23 catch (CiviCRM_API3_Exception
$e) {
25 $errorMessage = $e->getMessage();
26 $errorCode = $e->getErrorCode();
27 $errorData = $e->getExtraParams();
29 'error' => $errorMessage,
30 'error_code' => $errorCode,
31 'error_data' => $errorData,
39 * Function returns array of result expected from previous function.
44 function contact_get_expectedresult() {
46 $expectedResult = array(
54 'contact_type' => 'Individual',
55 'contact_sub_type' => '',
56 'sort_name' => 'man2@yahoo.com',
57 'display_name' => 'man2@yahoo.com',
64 'legal_identifier' => '',
65 'external_identifier' => '',
69 'preferred_communication_method' => '',
70 'preferred_language' => 'en_US',
71 'preferred_mail_format' => 'Both',
78 'communication_style_id' => '',
83 'deceased_date' => '',
84 'household_name' => '',
85 'organization_name' => '',
87 'contact_is_deleted' => 0,
88 'current_employer' => '',
90 'street_address' => '1 my road',
91 'supplemental_address_1' => '',
92 'supplemental_address_2' => '',
94 'postal_code_suffix' => '',
98 'state_province_id' => '',
101 'phone_type_id' => '',
104 'email' => 'man2@yahoo.com',
109 'worldregion_id' => '',
110 'world_region' => '',
111 'individual_prefix' => '',
112 'individual_suffix' => '',
113 'communication_style' => '',
115 'state_province_name' => '',
116 'state_province' => '',
123 return $expectedResult;
127 * This example has been generated from the API test suite.
128 * The test that created it is called
129 * testContactGetEmail
130 * and can be found in
131 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
133 * You can see the outcome of the API tests at
134 * https://test.civicrm.org/job/CiviCRM-master-git/
136 * To Learn about the API read
137 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
139 * Browse the api on your own site with the api explorer
140 * http://MYSITE.ORG/path/to/civicrm/api/explorer
142 * Read more about testing here
143 * http://wiki.civicrm.org/confluence/display/CRM/Testing
145 * API Standards documentation:
146 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards