Import from SVN (r45945, r596)
[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 'gender_id' => '',
58 'gender' => '',
59 'prefix_id' => '',
60 'prefix' => '',
61 'suffix_id' => '',
62 'suffix' => '',
63 'current_employer' => '',
64 'address_id' => '',
65 'street_address' => '',
66 'supplemental_address_1' => '',
67 'supplemental_address_2' => '',
68 'city' => '',
69 'postal_code_suffix' => '',
70 'postal_code' => '',
71 'geo_code_1' => '',
72 'geo_code_2' => '',
73 'state_province_id' => '',
74 'state_province_name' => '',
75 'state_province' => '',
76 'country_id' => '',
77 'country' => '',
78 'phone_id' => '',
79 'phone_type_id' => '',
80 'phone' => '',
81 'email_id' => '1',
82 'email' => 'man2@yahoo.com',
83 'on_hold' => 0,
84 'im_id' => '',
85 'provider_id' => '',
86 'im' => '',
87 'worldregion_id' => '',
88 'world_region' => '',
89 'id' => '1',
90 ),
91 ),
92 );
93
94 return $expectedResult ;
95 }
96
97
98 /*
99 * This example has been generated from the API test suite. The test that created it is called
100 *
101 * testContactGetEmail and can be found in
102 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
103 *
104 * You can see the outcome of the API tests at
105 * http://tests.dev.civicrm.org/trunk/results-api_v3
106 *
107 * To Learn about the API read
108 * http://book.civicrm.org/developer/current/techniques/api/
109 *
110 * and review the wiki at
111 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
112 *
113 * Read more about testing here
114 * http://wiki.civicrm.org/confluence/display/CRM/Testing
115 *
116 * API Standards documentation:
117 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
118 */