3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * This api exposes CiviCRM survey/petition records.
15 * @note Campaign component must be enabled.
16 * @note There is no "petition" api.
17 * Surveys and petitions are the same basic object and this api is used for both.
19 * @package CiviCRM_APIv3
23 * Create or update a survey.
25 * @param array $params
26 * Array per getfields metadata.
31 function civicrm_api3_survey_create($params) {
32 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params, 'Survey');
36 * Adjust Metadata for Create action.
38 * The metadata is used for setting defaults, documentation & validation.
40 * @param array $params
41 * Array of parameters determined by getfields.
43 function _civicrm_api3_survey_create_spec(&$params) {
44 $params['title']['api.required'] = 1;
48 * Returns array of surveys matching a set of one or more group properties.
50 * @param array $params
51 * Array of properties. If empty, all records will be returned.
54 * API result Array of matching surveys
56 function civicrm_api3_survey_get($params) {
57 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__
), $params, TRUE, 'Survey');
61 * Delete an existing survey.
63 * This method is used to delete any existing survey given its id.
65 * @param array $params
71 function civicrm_api3_survey_delete($params) {
72 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
76 * Set default getlist parameters.
78 * @see _civicrm_api3_generic_getlist_defaults
80 * @param array $request
84 function _civicrm_api3_survey_getlist_defaults(&$request) {
86 'description_field' => [