4 * Test Generated API Example.
5 * See bottom of this file for more detail.
9 * Test Generated example of using activity create API.
15 function activity_create_example() {
17 'source_contact_id' => 1,
18 'activity_type_id' => '51',
19 'subject' => 'test activity type id',
20 'activity_date_time' => '2011-06-02 14:36:13',
24 'location' => 'Pennsylvania',
25 'details' => 'a test activity',
26 'custom_1' => 'custom string',
30 $result = civicrm_api3('activity', 'create', $params);
32 catch (CiviCRM_API3_Exception
$e) {
34 $errorMessage = $e->getMessage();
35 $errorCode = $e->getErrorCode();
36 $errorData = $e->getExtraParams();
38 'error' => $errorMessage,
39 'error_code' => $errorCode,
40 'error_data' => $errorData,
48 * Function returns array of result expected from previous function.
53 function activity_create_expectedresult() {
55 $expectedResult = array(
63 'source_record_id' => '',
64 'activity_type_id' => '51',
65 'subject' => 'test activity type id',
66 'activity_date_time' => '20110602143613',
68 'location' => 'Pennsylvania',
71 'details' => 'a test activity',
78 'relationship_id' => '',
79 'is_current_revision' => '',
84 'engagement_level' => '',
90 return $expectedResult;
94 * This example has been generated from the API test suite.
95 * The test that created it is called
96 * testActivityCreateCustom
98 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
100 * You can see the outcome of the API tests at
101 * https://test.civicrm.org/job/CiviCRM-master-git/
103 * To Learn about the API read
104 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
106 * Browse the api on your own site with the api explorer
107 * http://MYSITE.ORG/path/to/civicrm/api/explorer
109 * Read more about testing here
110 * http://wiki.civicrm.org/confluence/display/CRM/Testing
112 * API Standards documentation:
113 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards