Details
-
Type: New Feature
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.8
-
Fix Version/s: 4.7.11
-
Component/s: CiviCRM API
-
Labels:
-
Documentation Required?:Developer Doc
-
Sprint:4.7.10 api, 4.7.11 API
-
Funding Source:Contributed Code
Description
A generic validate action to verify the correctness of an API action w.r.t the given parameters.
$result = civicrm_api3('Contact', 'validate', array('action' => 'create', 'params' => array('first_name' => 'batman'));
Use-case:
try { $result = civicrm_api3('Contribution', 'validate', array('action' => 'create', 'params' => array('start_date' => 'banana')); $result = civicrm_api3('Contribution', 'create', array(array('start_date' => 'banana')); } catch (CiviCRM_API3_Exception $e) { foreach ($e->getErrors() as $key => $value) } // do something } }