CiviCRM

Profile Search API

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed/Completed
  • Affects Version/s: 2.2.5
  • Fix Version/s: 4.2
  • Component/s: CiviCRM API
  • Labels:
    None

Description

Here's my cut at an API extension to allow a profile search which will return results to an API call similar to a publicly exposed search profile

Criteria I was looking at / decisions I made:

- Information available should be equivalent to that exposed through the search profile (and to the same people). Profiles that are not set for search should not be available, likewise if not in the selector fields should not be returned.

- sort_name included in results even if not in the profile - as per search profile behaviour, sort_name is default sort order.

- JSON formatted response available.

- separate path for the call than the main REST calls to allow anonymous access.

- Change to REST adds a function which makes sure this is the only api call that can be made via that path

- I tried not to tinker with any core code but did need to make a small change to CRM\Profile\Selector\Listings.php so make it work (below). Also, inserted xml below into crM\Core\xml\Menu\misc.xml

- I filtered out the extraneous info returned from Selector\Listings.php in the api function rather than suggest changes to listings.php. They come from line 474 ( $row[] = CRM_Contact_BAO_Contact_Utils::getImage( $result->contact_type );) and line 575 ( $row[] = CRM_Core_Action::formLink( $newLinks,
                                                $mask,
                                                $params );)


Included files
api\v2\Profile.php
CRM\Utils\REST.php
CRM\Profile\Selector\Listings.php

Addition to menu. CRM\Core\xml\Menu\misc.xml

  <item>
    <path>civicrm/ajax/rest/profile</path>
    <page_callback>CRM_Utils_REST::ajaxProfile</page_callback>
    <access_arguments>profile listings and forms</access_arguments></item>


Change to line 367-388
CRM/Utils/Sort.php
367c367
< if( $sort ) {
---
> if(is_array( $sort )) {
385c385
< }
---
>
388c388
<
---
> }
  1. Listings.php
    13/Jun/09 11:33 PM
    22 kB
    Eileen McNaughton
  2. Profile.php
    13/Jun/09 11:33 PM
    5 kB
    Eileen McNaughton
  3. REST.php
    13/Jun/09 11:33 PM
    13 kB
    Eileen McNaughton

Activity

Hide
Donald A. Lobo added a comment -

Hey Wes:

can u shepherd this thru the API process

Eilieen: can u work with Walt at Dharmatech and also get a bunch of unit tests written for this API. We are pretty aggressively writing unit tests for all api functionality and hence need this done for any newly added api's also

Show
Donald A. Lobo added a comment - Hey Wes: can u shepherd this thru the API process Eilieen: can u work with Walt at Dharmatech and also get a bunch of unit tests written for this API. We are pretty aggressively writing unit tests for all api functionality and hence need this done for any newly added api's also
Hide
Eileen McNaughton added a comment -
I'm pretty sure the edit made to listings.php is obsolete now
Show
Eileen McNaughton added a comment - I'm pretty sure the edit made to listings.php is obsolete now
Hide
Eileen McNaughton added a comment -
This is superceded now (profile API probably does the same thing & code is too old to be useful)
Show
Eileen McNaughton added a comment - This is superceded now (profile API probably does the same thing & code is too old to be useful)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: