4 * Test Generated API Example.
5 * See bottom of this file for more detail.
9 * Test Generated example of using contact get API.
11 * This demonstrates use of the 'format.id_only' param.
12 /* This param causes the id of the only entity to be returned as an integer.
13 /* it will be ignored if there is not exactly 1 result
18 function contact_get_example() {
21 'format.only_id' => 1,
25 $result = civicrm_api3('contact', 'get', $params);
27 catch (CiviCRM_API3_Exception
$e) {
29 $errorMessage = $e->getMessage();
30 $errorCode = $e->getErrorCode();
31 $errorData = $e->getExtraParams();
33 'error' => $errorMessage,
34 'error_code' => $errorCode,
35 'error_data' => $errorData,
43 * Function returns array of result expected from previous function.
48 function contact_get_expectedresult() {
52 return $expectedResult;
56 * This example has been generated from the API test suite.
57 * The test that created it is called
58 * testContactGetFormatID_only
60 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
62 * You can see the outcome of the API tests at
63 * https://test.civicrm.org/job/CiviCRM-master-git/
65 * To Learn about the API read
66 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
68 * Browse the api on your own site with the api explorer
69 * http://MYSITE.ORG/path/to/civicrm/api/explorer
71 * Read more about testing here
72 * http://wiki.civicrm.org/confluence/display/CRM/Testing
74 * API Standards documentation:
75 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards