5 * Our original intention was not to have an update action. However, we wound up having
6 * to retain it for backward compatibility. The only difference between update and create
7 * is that update will throw an error if id is not a number
9 * @param $apiRequest an array with keys:
13 * - function: callback (mixed)
14 * - params: array, varies
16 function civicrm_api3_generic_update($apiRequest) {
18 if (!array_key_exists('id', $apiRequest['params']) ||
19 empty($apiRequest['params']['id']) ||
20 !is_numeric($apiRequest['params']['id'])) {
21 throw new api_Exception("Mandatory parameter missing `id`", 2000);
23 return civicrm_api($apiRequest['entity'], 'create', $apiRequest['params']);