Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-18981

Add a 'validate' action to CiviCRM API

    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
        }
      }
      

        Attachments

          Activity

            People

            • Assignee:
              saurabh.batra Saurabh Batra
              Reporter:
              saurabh.batra Saurabh Batra
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: