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_mail_format' => 'Both',
63 'deceased_date' => '',
64 'household_name' => '',
65 'organization_name' => '',
67 'contact_is_deleted' => 0,
68 'current_employer' => '',
70 'street_address' => '',
71 'supplemental_address_1' => '',
72 'supplemental_address_2' => '',
74 'postal_code_suffix' => '',
78 'state_province_id' => '',
81 'phone_type_id' => '',
84 'email' => 'man2@yahoo.com',
89 'worldregion_id' => '',
91 'individual_prefix' => '',
92 'individual_suffix' => '',
94 'state_province_name' => '',
95 'state_province' => '',
102 return $expectedResult;
107 * This example has been generated from the API test suite. The test that created it is called
109 * testContactGetEmail and can be found in
110 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
112 * You can see the outcome of the API tests at
113 * http://tests.dev.civicrm.org/trunk/results-api_v3
115 * To Learn about the API read
116 * http://book.civicrm.org/developer/current/techniques/api/
118 * and review the wiki at
119 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
121 * Read more about testing here
122 * http://wiki.civicrm.org/confluence/display/CRM/Testing
124 * API Standards documentation:
125 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards