Merge pull request #1046 from colemanw/showHide
[civicrm-core.git] / api / v3 / examples / ContactGet.php
1 <?php
2
3 /*
4
5 */
6 function contact_get_example(){
7 $params = array(
8 'email' => 'man2@yahoo.com',
9 'version' => 3,
10 );
11
12 $result = civicrm_api( 'contact','get',$params );
13
14 return $result;
15 }
16
17 /*
18 * Function returns array of result expected from previous function
19 */
20 function contact_get_expectedresult(){
21
22 $expectedResult = array(
23 'is_error' => 0,
24 'version' => 3,
25 'count' => 1,
26 'id' => 1,
27 'values' => array(
28 '1' => array(
29 'contact_id' => '1',
30 'contact_type' => 'Individual',
31 'contact_sub_type' => '',
32 'sort_name' => 'man2@yahoo.com',
33 'display_name' => 'man2@yahoo.com',
34 'do_not_email' => 0,
35 'do_not_phone' => 0,
36 'do_not_mail' => 0,
37 'do_not_sms' => 0,
38 'do_not_trade' => 0,
39 'is_opt_out' => 0,
40 'legal_identifier' => '',
41 'external_identifier' => '',
42 'nick_name' => '',
43 'legal_name' => '',
44 'image_URL' => '',
45 'preferred_mail_format' => 'Both',
46 'first_name' => '',
47 'middle_name' => '',
48 'last_name' => '',
49 'job_title' => '',
50 'birth_date' => '',
51 'is_deceased' => 0,
52 'deceased_date' => '',
53 'household_name' => '',
54 'organization_name' => '',
55 'sic_code' => '',
56 'contact_is_deleted' => 0,
57 'current_employer' => '',
58 'address_id' => '',
59 'street_address' => '',
60 'supplemental_address_1' => '',
61 'supplemental_address_2' => '',
62 'city' => '',
63 'postal_code_suffix' => '',
64 'postal_code' => '',
65 'geo_code_1' => '',
66 'geo_code_2' => '',
67 'state_province_id' => '',
68 'state_province_name' => '',
69 'state_province' => '',
70 'country_id' => '',
71 'country' => '',
72 'phone_id' => '',
73 'phone_type_id' => '',
74 'phone' => '',
75 'email_id' => '1',
76 'email' => 'man2@yahoo.com',
77 'on_hold' => 0,
78 'im_id' => '',
79 'provider_id' => '',
80 'im' => '',
81 'worldregion_id' => '',
82 'world_region' => '',
83 'id' => '1',
84 ),
85 ),
86 );
87
88 return $expectedResult ;
89 }
90
91
92 /*
93 * This example has been generated from the API test suite. The test that created it is called
94 *
95 * testContactGetEmail and can be found in
96 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
97 *
98 * You can see the outcome of the API tests at
99 * http://tests.dev.civicrm.org/trunk/results-api_v3
100 *
101 * To Learn about the API read
102 * http://book.civicrm.org/developer/current/techniques/api/
103 *
104 * and review the wiki at
105 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
106 *
107 * Read more about testing here
108 * http://wiki.civicrm.org/confluence/display/CRM/Testing
109 *
110 * API Standards documentation:
111 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
112 */