<?php
-
-/*
-
+/**
+ * Test Generated example of using contact get API
+ * *
*/
function contact_get_example(){
$params = array(
'email' => 'man2@yahoo.com',
- 'version' => 3,
);
- $result = civicrm_api( 'contact','get',$params );
+try{
+ $result = civicrm_api3('contact', '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 contact_get_expectedresult(){
'nick_name' => '',
'legal_name' => '',
'image_URL' => '',
+ 'preferred_communication_method' => '',
+ 'preferred_language' => 'en_US',
'preferred_mail_format' => 'Both',
'first_name' => '',
'middle_name' => '',
'last_name' => '',
+ 'prefix_id' => '',
+ 'suffix_id' => '',
'job_title' => '',
+ 'gender_id' => '',
'birth_date' => '',
'is_deceased' => 0,
'deceased_date' => '',
'geo_code_1' => '',
'geo_code_2' => '',
'state_province_id' => '',
- 'state_province_name' => '',
- 'state_province' => '',
'country_id' => '',
- 'country' => '',
'phone_id' => '',
'phone_type_id' => '',
'phone' => '',
'im' => '',
'worldregion_id' => '',
'world_region' => '',
+ 'individual_prefix' => '',
+ 'individual_suffix' => '',
+ 'gender' => '',
+ 'state_province_name' => '',
+ 'state_province' => '',
+ 'country' => '',
'id' => '1',
),
),
);
- return $expectedResult ;
+ return $expectedResult;
}
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
-*/
\ No newline at end of file
+*/