3 * Test Generated example of using website get API.
5 * Demonostrates returning field metadata
10 function website_get_example() {
20 $result = civicrm_api3('website', 'get', $params);
22 catch (CiviCRM_API3_Exception
$e) {
24 $errorMessage = $e->getMessage();
25 $errorCode = $e->getErrorCode();
26 $errorData = $e->getExtraParams();
28 'error' => $errorMessage,
29 'error_code' => $errorCode,
30 'error_data' => $errorData,
38 * Function returns array of result expected from previous function.
43 function website_get_expectedresult() {
45 $expectedResult = array(
55 'title' => 'Website ID',
57 'api.aliases' => array(
61 'contact_id' => array(
62 'name' => 'contact_id',
65 'FKClassName' => 'CRM_Contact_DAO_Contact',
66 'FKApiName' => 'Contact',
75 'where' => 'civicrm_website.url',
76 'headerPattern' => '/Website/i',
77 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
83 'website_type_id' => array(
84 'name' => 'website_type_id',
86 'title' => 'Website Type',
90 'pseudoconstant' => array(
91 'optionGroupName' => 'website_type',
98 return $expectedResult;
102 * This example has been generated from the API test suite.
103 * The test that created it is called
105 * and can be found in
106 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php
108 * You can see the outcome of the API tests at
109 * https://test.civicrm.org/job/CiviCRM-master-git/
111 * To Learn about the API read
112 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
114 * Browse the api on your own site with the api explorer
115 * http://MYSITE.ORG/path/to/civicrm/api
117 * Read more about testing here
118 * http://wiki.civicrm.org/confluence/display/CRM/Testing
120 * API Standards documentation:
121 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards