Added by admin, last edited by admin on Jan 27, 2012  (view change)

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

BookingBug REST API: sessions

Purpose

Used for creating, editing and deleting sessions. A session is either a single bookable event, a set of events which are booked together (course), or a set of separately bookable events of the same type (recurring event).

URL

http://uk.bookingbug.com/api/sessions.xml
http://www.bookingbug.com/api/sessions.xml

Formats

xml

Authentication

Basic HTTP Authentication is used to verify that user is authorised to access data requested.

Parameters
param type description required? default
name string(50)      
type integer Specifies either individual event, recurring event, or course (see below)    
start_date string Date of first occurrance. Format: YYYY-MM-DD    
end_date string Date of last occurrance. Format: YYYY-MM-DD    
duration integer Duration of session in minutes   60
time string Start time of session for all occurances. Format: HH:MM   time at creation of session
group string Sessions are displayed in the widget according to their group yes  
description string      
spaces integer Number of spaces for attendees   1
price decimal(8,2)      
max_num_bookings integer Maximum number of spaces that a booker is permitted to book   1
repeat integer Frequency of the session reoccurring    
disabled boolean     false
min_cancel integer Minimum number of days prior to event that it can be cancelled   1
max_advance integer Maximum number of days in advance that the session can be booked    
ask_address boolean      
ticket_type integer Indicates whether questions are required per user or for booking group (see below)    

session_type

value description
0 one-off event
1 course
2 recurring event

repeat

value description
0 does not repeat
1 weekly
2 fortnightly
3 weekdays only
4 weekends only
5 daily
6 custom
7 monthly (repeat by day)
8 monthly (repeat by week day)

If a value of 6 is set (custom) the dates, times and durations of the custom slots should also be specified in the request.

For example:

<session>
  <repeat>6</repeat>
  <slots>
    <slot>
      <date>2020-01-01</date>
      <time>11:00</time</date>
      <duration>60</duration>
    </slot>
    <slot>
      <date>2020-02-10</date>
      <time>11:10</time>
      <duration>50</duration>
    </slot>
    <slot>
      <date>2020-03-20</date>
      <time>9:30</time>
      <duration>90</duration>
    </slot>
  </slots>
</session>  

ticket_type

value description
0 no per-ticket information is required
1 tickets are assigned to one person but questions are asked per user
2 tickets are assigned per-user at purchase, requiring a member email for each user
3 tickets are assigned per-user at purchase but are reassignable

List Sessions

Request
curl --url http://uk.bookingbug.com/api/sessions.xml -u<username>:<password>

<username> and <password> are the login details to access data for a particular company.

Response
<sessions>
  <session id="123">
    <name>My Event</name>
    <group>My Group</group>
  </session>
  <session id="124">
    <name>Another Event</name>
    <group>My Group</group>
  </session>
</sessions>

Show Session

Request
curl --url http://uk.bookingbug.com/api/sessions/<id>.xml -u<username>:<password>

<username> and <password> are the login details to access data for a particular company
<id> is the session id that is to be requested.

Response
<session id="123">
  <name>My Event</name>
  <group>My Group</group>
  <time>10:00</time>
  <start_date>2011-08-10</start_date>
  <end_date>2011-08-15</end_date>
  <slots>
    <slot id="123456">
      <date>2011-08-10</date>
      <spaces_booked>0</spaces_booked>
      <spaces_reserved>0</spaces_reserved>
    </slot>
    <slot id="123457">
      <date>2011-08-15</date>
      <spaces_booked>0</spaces_booked>
      <spaces_reserved>0</spaces_reserved>
    </slot>
  </slots>
</session>

Create New Event

Request

This is a request to create a new session with defaults appropriate for an individual event.

curl --url http://uk.bookingbug.com/api/sessions.xml?type=event -u<username>:<password> -H Content-Type:text/xml -X POST -d "<xml>"

<username> and <password> are the login details to access data for a particular company
<xml> is the xml markup for the event to be created

<session>
  <name>My Event</name>
  <group>My Group</group>
</session>
param default
name "My Event"
start_date one week from today
end_date equal to start_date
repeat 0
time now
duration 120 (minutes)
min_cancel 5
Response

201 CREATED

Create New Course

Request

This is a request to create a new session with defaults appropriate for a course.

curl --url http://uk.bookingbug.com/api/sessions.xml?type=course -u<username>:<password> -H Content-Type:text/xml -X POST -d "<xml>"

<username> and <password> are the login details to access data for a particular company
<id> is the session id that is to be deleted.
<xml> is the xml markup for the course to be created

<session>
  <name>My Course</name>
  <group>My Group</group>
</session>
param default
name "My Course"
start_date one week from today
end_date equal to start_date
repeat 6
time now
duration 60 (minutes)
min_cancel 5
Response

201 CREATED

Create New Recurring Event

Request

This is a request to create a new session with defaults appropriate for a weekly recurring event.

curl --url http://uk.bookingbug.com/api/sessions.xml?type=recurring_event -u<username>:<password> -H Content-Type:text/xml -X POST -d "<xml>"

<username> and <password> are the login details to access data for a particular company
<id> is the session id that is to be deleted.
<xml> is the xml markup for the recurring event to be created

<session>
  <name>My Course</name>
  <group>My Group</group>
</session>
param default
name "My Recurring Event"
start_date one week from today
repeat 1
time now
duration 60 (minutes)
min_cancel 5
max_advance 60
Response

201 CREATED

Update session

Request
curl --url http://uk.bookingbug.com/api/sessions/<id>.xml -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"

<username> and <password> are the login details to access data for a particular company
<id> is the session id that is to be updated.
<xml> is the xml markup for the session attributes to be changed

<session>
  <name>My New Session Name</name>
  <slots>
    <slot>
      <date>2020-01-01</date>
    </slot>
    <slot>
      <date>2020-01-03</date>
    </slot>
  </slots>
</session>

If custom slots are specified the existing slots for the session will be deleted.

Individual existing slots can be modified using the following request:

curl --url http://uk.bookingbug.com/api/slots/<id>.xml -u<username>:<password> -H Content-Type:text/xml -X PUT -d "<xml>"

<username> and <password> are the login details to access data for a particular company
<id> is the slot id that is to be updated.
<xml> is the xml markup for the slot attributes to be changed

<slot>
  <date>2020-01-05</date>
  <time>11:30</time>
  <duration>35</duration>
</slot>
Response

200 OK

Destroy Session

Request
curl --url http://uk.bookingbug.com/api/sessions/<id>.xml -u<username>:<password> -H Content-Type:text/xml -X DELETE 

<username> and <password> are the login details to access data for a particular company
<id> is the session id that is to be deleted.

Response

200 OK