3 * Test Generated example demonstrating the 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 "testGetMetadata"
104 * and can be found at:
105 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php
107 * You can see the outcome of the API tests at
108 * https://test.civicrm.org/job/CiviCRM-master-git/
110 * To Learn about the API read
111 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
113 * Browse the api on your own site with the api explorer
114 * http://MYSITE.ORG/path/to/civicrm/api
116 * Read more about testing here
117 * http://wiki.civicrm.org/confluence/display/CRM/Testing
119 * API Standards documentation:
120 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards