3 * Test Generated example demonstrating the Address.create API.
8 function address_create_example() {
11 'location_type_id' => 6,
12 'street_name' => 'Ambachtstraat',
13 'street_number' => '23',
14 'street_address' => 'Ambachtstraat 23',
15 'postal_code' => '6971 BN',
16 'country_id' => '1152',
22 $result = civicrm_api3('Address', 'create', $params);
24 catch (CiviCRM_API3_Exception
$e) {
26 $errorMessage = $e->getMessage();
27 $errorCode = $e->getErrorCode();
28 $errorData = $e->getExtraParams();
30 'error' => $errorMessage,
31 'error_code' => $errorCode,
32 'error_data' => $errorData,
40 * Function returns array of result expected from previous function.
45 function address_create_expectedresult() {
47 $expectedResult = array(
56 'location_type_id' => '6',
59 'street_address' => 'Ambachtstraat 23',
60 'street_number' => '23',
61 'street_name' => 'Ambachtstraat',
63 'postal_code' => '6971 BN',
64 'country_id' => '1152',
65 'manual_geo_code' => 0,
70 return $expectedResult;
74 * This example has been generated from the API test suite.
75 * The test that created it is called "testCreateAddress"
76 * and can be found at:
77 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php
79 * You can see the outcome of the API tests at
80 * https://test.civicrm.org/job/CiviCRM-master-git/
82 * To Learn about the API read
83 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
85 * Browse the api on your own site with the api explorer
86 * http://MYSITE.ORG/path/to/civicrm/api
88 * Read more about testing here
89 * http://wiki.civicrm.org/confluence/display/CRM/Testing
91 * API Standards documentation:
92 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards