Details
Description
Kurund - These APIs pretty much follow the Membership APIs so you can clone that file and modify from there. I simplified a few of the naming patterns (crm_create_participant instead of crm_create_contact_membership for example). Let me know if you think the params / patterns / naming for these need adjusting for ease of implementation or consistency.
*******************
-
-
- Event APIs ***
*******************
crm_create_event( $params )
Required: $params['title'], $params['event_type_id'], $params['start_date']
Use the following defaults for other NOT NULL DB columns if values are not passed in params:
is_public = 1
is_online_registration = 0
is_monetary = 0
contribution_type_id = 0
is_map = 0
is_active = 1
- Event APIs ***
-
crm_update_event( $params )
Required: $params['event_id']
crm_delete_event( $eventID )
Required: $eventID
crm_get_events( &$params, $return_properties = null, $sort = null, $offset = 0, $row_count = 25 )
For now, $params supports the following inputs (same as for iCal feed):
- 'start_date' - yyyymmdd format, default = today
- 'dur' - duration of search range in days, default = 30
- 'event_type_id' - default = NULL (returns any event type)
... if it's trivial to support location parameters as well, that will be useful (e.g. 'city', 'state_province'). If not, we'll add them as needed.
Returns an array of event properties (all available OR those specified in $return_properties).
*************************
-
-
- Participant APIs ***
*************************
crm_get_participants( $params )
Required: $params['event_id'] OR $params['contact_id']
Returns array of all available civicrm_participant properties for all civicrm_participant records WHERE event_id = $params['event_id'] and/or contact_id = $params['contact_id']. API users will have to filter on status_id if they only want participations with specific status(es).
- Participant APIs ***
-
crm_create_participant( $params, $contactID )
Required: $params['event_id'], $contactID
Use default for status_id (1), and use today() for register_date IF NOT passed.
crm_update_participant( $params )
Required: $params['id'] (PK of civicrm_participant record to be updated)
crm_delete_participant( $participantID )
Required: $participantID
***********************************
-
-
- Participant Payment APIs ***
***********************************
crm_create_participant_payment( $params )
Required: $params['participant_id'], $params['contribution_id']
- Participant Payment APIs ***
-
crm_update_participant_payment( $params )
Required params =
crm_delete_participant_payment( $participantPaymentID )
NOTES:
For now, if API users want to register a participant for a paid event they will need to make 3 API calls:
- crm_create_contact_participant
- crm_create_contribution
- crm_create_participant_payment