updated examples
[civicrm-core.git] / api / v3 / examples / ActivityTypeGet.php
index 250250e7f2bc9534824ee2f9a0c788e956cf1ff6..7db5bde5ece7dda5903fa3812205cd0f7e4b51f7 100644 (file)
@@ -1,19 +1,26 @@
 <?php
-
-/*
+/**
+ * Test Generated example of using activity_type get API
+ * *
  */
 function activity_type_get_example(){
-$params = array(
-  'version' => 3,
-);
+$params = array();
 
-  $result = civicrm_api( 'activity_type','get',$params );
+try{
+  $result = civicrm_api3('activity_type', 'get', $params);
+}
+catch (CiviCRM_API3_Exception $e) {
+  // handle error here
+  $errorMessage = $e->getMessage();
+  $errorCode = $e->getErrorCode();
+  $errorData = $e->getExtraParams();
+  return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
+}
 
-  return $result;
+return $result;
 }
 
-/*
+/**
  * Function returns array of result expected from previous function
  */
 function activity_type_get_expectedresult(){
@@ -71,7 +78,7 @@ function activity_type_get_expectedresult(){
     ),
 );
 
-  return $expectedResult  ;
+  return $expectedResult;
 }
 
 
@@ -95,4 +102,4 @@ function activity_type_get_expectedresult(){
 *
 * API Standards documentation:
 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
-*/
\ No newline at end of file
+*/