3 * Test Generated example of using address create API
4 * Demonstrates Use of address parsing param *
6 function address_create_example(){
9 'street_address' => '54A Excelsior Ave. Apt 1C',
10 'location_type_id' => 7,
15 $result = civicrm_api3('address', 'create', $params);
17 catch (CiviCRM_API3_Exception
$e) {
19 $errorMessage = $e->getMessage();
20 $errorCode = $e->getErrorCode();
21 $errorData = $e->getExtraParams();
22 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
29 * Function returns array of result expected from previous function
31 function address_create_expectedresult(){
33 $expectedResult = array(
42 'location_type_id' => '7',
45 'street_address' => '54A Excelsior Ave. Apt 1C',
46 'street_number' => '54',
47 'street_number_suffix' => 'A',
48 'street_name' => 'Excelsior Ave.',
49 'street_unit' => 'Apt 1C',
50 'manual_geo_code' => 0,
55 return $expectedResult;
60 * This example has been generated from the API test suite. The test that created it is called
62 * testCreateAddressParsing and can be found in
63 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/AddressTest.php
65 * You can see the outcome of the API tests at
66 * http://tests.dev.civicrm.org/trunk/results-api_v3
68 * To Learn about the API read
69 * http://book.civicrm.org/developer/current/techniques/api/
71 * and review the wiki at
72 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
74 * Read more about testing here
75 * http://wiki.civicrm.org/confluence/display/CRM/Testing
77 * API Standards documentation:
78 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards