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