|
Contents
Contact APIs (Individuals, Households and Organizations)
civicrm_contact_create( &$params )Availability: v2.2.3 Add a contact. If 'dupe_check' is set to true in $params array, then dupe checking will be done while creating the contact (In earlier versions than 2.2.3, use civicrm_contact_add). Parameters:
Returns:
Creating a Contact Result
civicrm_contact_update( &$params )Availability: v2.2.3 Update a contact. (In earlier versions than 2.2.3, use civicrm_contact_add with a contact_id). Parameters:
Returns:
Updating a Contact Result
civicrm_contact_get( &$params )
Returns an array of contacts using the contact_id as the array key . The $params can contain the following parameters any of the parameters that would be retrieved using contact get An empty array is returned if there is no match. Do print_r on the returned value from the example below to examine the array and properties returned in your site. Please note: you can use a custom field to get details of a contact too. You need to find the ID for your specific custom field in the table civicrm_custom_field. If the ID of the custom field is for example 9, you can use custom_9 (so $params = array('custom_9' => '345678' and then $retrieved = &civicrm_contact_get( $params). Parameters:
Returns:
Example: civicrm_contact_get( ) Result How to add contact's website in a query: In CiviCRM 3.2 websites (previously home_URL) have their own table in database which makes possible to have multiple websites per contact. Therefore the API has changed a bit. Now you have to define website as an array and you will get an array as well. Example: civicrm_contact_get( ) Result How To Retrieve Custom Fields: It is possible to retrieve specific fields (both standard contact fields and custom contact fields) using the following param structure where N is the field id of the custom field in the civicrm_custom_field table. You can specify as many fields as you want in the params array: Example: civicrm_contact_get( ) Result
civicrm_contact_delete( &$params )Availability: v1.8 Deletes the specified contact. Parameters:
Returns:
Example: civicrm_contact_delete( )
civicrm_contact_search( &$params ) - DEPRECATEDAvailability: v1.8 You should use the get api Parameters:
Note: As of 2.x API, civicrm_contact_search() will enforce a 25 contact limit on number of contacts returned. If you want to return more than 25 contacts, add "rowCount" => XXXX to your $params array, where XXXX is the top limit on number of contacts you want returned. Returns:
Example: civicrm_contact_search( ) Result Sort and Paging: Example: sorting and paging civicrm_contact_search_count( &$params )Availability: v1.8
Returns:
Example: civicrm_contact_search( ) |
Contact APIs
Labels
