5806b7cb4c29ad3e011ecbdfa2a76fcc0128308f
[civicrm-core.git] / api / v3 / examples / Contact / CustomFieldGet.php
1 <?php
2
3 /*
4 /*this demonstrates setting a custom field through the API
5 */
6 function contact_get_example(){
7 $params = array(
8 'first_name' => 'abc1',
9 'contact_type' => 'Individual',
10 'last_name' => 'xyz1',
11 'version' => 3,
12 'custom_3' => 'custom string',
13 );
14
15 $result = civicrm_api( 'contact','get',$params );
16
17 return $result;
18 }
19
20 /*
21 * Function returns array of result expected from previous function
22 */
23 function contact_get_expectedresult(){
24
25 $expectedResult = array(
26 'is_error' => 0,
27 'version' => 3,
28 'count' => 1,
29 'id' => 1,
30 'values' => array(
31 '1' => array(
32 'contact_id' => '1',
33 'civicrm_value_testgetwithcu_3_id' => '1',
34 'custom_3' => 'custom string',
35 'id' => '1',
36 ),
37 ),
38 );
39
40 return $expectedResult ;
41 }
42
43
44 /*
45 * This example has been generated from the API test suite. The test that created it is called
46 *
47 * testGetWithCustom and can be found in
48 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
49 *
50 * You can see the outcome of the API tests at
51 * http://tests.dev.civicrm.org/trunk/results-api_v3
52 *
53 * To Learn about the API read
54 * http://book.civicrm.org/developer/current/techniques/api/
55 *
56 * and review the wiki at
57 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
58 *
59 * Read more about testing here
60 * http://wiki.civicrm.org/confluence/display/CRM/Testing
61 *
62 * API Standards documentation:
63 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
64 */