4 This demonstrates use of the 'format.single_entity_array' param.
5 /* This param causes the only contact to be returned as an array without the other levels.
6 /* it will be ignored if there is not exactly 1 result
8 function contact_getsingle_example(){
14 $result = civicrm_api( 'contact','getsingle',$params );
20 * Function returns array of result expected from previous function
22 function contact_getsingle_expectedresult(){
24 $expectedResult = array(
26 'contact_type' => 'Individual',
27 'contact_sub_type' => '',
29 'display_name' => 'Test Contact',
36 'legal_identifier' => '',
37 'external_identifier' => '',
41 'preferred_mail_format' => '',
42 'first_name' => 'Test',
44 'last_name' => 'Contact',
48 'deceased_date' => '',
49 'household_name' => '',
50 'organization_name' => '',
52 'contact_is_deleted' => 0,
53 'current_employer' => '',
55 'street_address' => '',
56 'supplemental_address_1' => '',
57 'supplemental_address_2' => '',
59 'postal_code_suffix' => '',
63 'state_province_id' => '',
64 'state_province_name' => '',
65 'state_province' => '',
69 'phone_type_id' => '',
77 'worldregion_id' => '',
82 return $expectedResult ;
87 * This example has been generated from the API test suite. The test that created it is called
89 * testContactGetSingle_entity_array and can be found in
90 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
92 * You can see the outcome of the API tests at
93 * http://tests.dev.civicrm.org/trunk/results-api_v3
95 * To Learn about the API read
96 * http://book.civicrm.org/developer/current/techniques/api/
98 * and review the wiki at
99 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
101 * Read more about testing here
102 * http://wiki.civicrm.org/confluence/display/CRM/Testing
104 * API Standards documentation:
105 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards