Documentatie
Moeilijkheidsgraad:
API - Event - POST event/subscribe
POST event/subscribe
Used for
Adding a booking for a specific event. The same can be achieved by the API for adding a booking. However, for events this method is easier.
Authentication
Anonymous access is allowed. If anonymous access, then update on customer id is not allowed.
If user is logged in, it depends on the rights. Making a booking:
- entity_booking_create_own - means user is allowed to create booking for customer which belongs to current logged in user
- entity_booking_create_owngroup - means user is allowed to create booking for customer which belongs to current logged in usergroup
- entity_booking_create_other - means user is allowed to create booking for customers in other groups
- entity_booking_create_all - means user is allowed to create booking for all customers
- Updating a customer needs - entity_customer_update
- Creating a customer needs - entity_customer_create
- Updating a customer other than the logged in user - means the user needs to have the right: entity_customer_update_other
Parameters
Parameter | Description | Required | Example |
---|---|---|---|
event_id | Event ID of the booking | Yes | 2012-08-08_1 |
customer | Customer object can be supplied If customer_id is supplied, the booking will be attached to that existing customer |
No | |
options | An array of options, each in combination of the option_name and the required number | No | |
participants | An array of participants, each combination contains at least the participant_id and optional participant fields | No | |
voucher | An array of voucher codes. Only valid codes are used. No feedback is given for invalid codes. |
No | VALIDVOUCHER1,VALIDVOUCHER2,INVALIDVOUCHER |
customX | A custom field, replace x with the number of the field. I.e. "custom01" is the name of the first custom field. Use the raw value for posting the value in case of custom tables. |
No |
Example
Adding a booking for 3 people (in this case 2 adults and 1 child). Include a new customer and include an option.
POST api/rest/event/subscribe
Request: { "event_id": "2012-08-08_1", "customer": { "lastname": "Demo" }, "participants": { "0": { "id": "1", "lastname": "Ester" }, "1": { "id": "1", "lastname": "Ester" }, "2": { "id": "2", "lastname": "Ester" } }, "options": { "0": { "taart": "1" } } }
Response: { "status": true, "booking_id": 40690, "messages": [ "Booking made" ] }