Added by admin, last edited by admin on Mar 18, 2010  (view change)

Labels:

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

BookingBug REST API: service

Purpose

Used for creating, editing and deleting services. The service is an time based offering which a business allows it's customers to book or inquire about. This must be combined with a person and/or a resource in order to make a bookable object.

URL

http://[site].bookingbug.com/api/company.format

Formats

json, xml

Authentication

Requires business API access

Parameters

There are many parameters to service, most of which are optional, are relevant only to a particular type of business. Most options will either default to a sensible default value, or take their default from global company configuration

param type description required? used with default
name string(50) A name for the service. This could be anything from 'villa rental', or 'court hire', 'juggling lessons' ! Yes  All  
description text A longer description of the service No All   
service_type service_type
An optional paramter for business that use multiple types of service. Not required if this business uses a single time basis for their bookings

No Mixed  
duration integer The base duration of a service in minutes - this must be in rounded to 5 minute intervals No Time 60
duration_step integer A time interval in minutes (rounded to 5 minutes) in which the service is available to be booked. This does not have to match the duration. For example appointments may last an hour, but be able to be booked on the half hour. The default is the same as the duration No Time 0
min_bookings integer The mimum bookings in a row that must be taken for this service No All 1
max_bookings integer
The maximum bookings in a row that can be taken for this service No All 1
max_advance integer  The number of days in advance that a service can be booked or enquired about by a customer  No  All  60
min_book_days integer The minimum number of days in advance that new customers can book (allows time for vetting) No All 0
ask_address bool True if the service requires the customers address. By default only name, email and phone are given No All false
listed_duration integer A different duration that can be shown for bookings rather then then real duration. For example if a booking slot is every hour, but you need to say to customers that a booking is for 50 minutes rather than the full hour. Default is to use the full duration No Time -
spaces integer The number of spaces for this service. This allows for a service that can be booked by a number of people for the same resource/person at the same time No All 1
disabled bool Allows a service to be disabled so that it can no longer be booked. Services that have bookings cannot be deleted to maintain historical booking information, but they can be disabled such that no new bookings can be made. Service can be disabled or enabled at any time No All false
pre_time integer A default reserved time in minutes (5 minute steps) before the booking used for flexible appointments such as those that travel or have long preparation/setup times No Flex 0
post_time integer A default reserved time in minutes (5 minute steps) after the booking used for flexible appointments such as those that travel
No Flex 0
price decimal(8.2) An optional single price for this service No All -
min_cancel integer The minimum number of days in advance of a booking in which a customer can cancel a booking automatically. This allows a customer to cancel the booking themselves up to this pint, past this point, the customer is shown a customizable message requesting that they contact the business directly No All 1
category_id
integer
BookingBug category id. (visit http://docs.bookingbug.com/display/API/View+available+categories for more details)
No
All
-

Advanced Settings

These settings control advanced settings that are normally set by default from the company wide configuration settings, but can optionally be controlled on a per-service basis

param type description used with
booking_type booking_type
The type of bookings that the public are allowed to make for this service. All
mbooking_type booking_type The type of booking that existing members are allowed to make for this service All
detail_group
detail_group
A structure of questions to be asked when this service is booked. If there is one set of one set of questions only for the business, then these will automatically be asked for this service, alternatively you can have a set of questions per-service All
Examples

Get List

XML

curl -basic --url http://[site].bookingbug.com/api/service.xml -uusername:password -H 'Content-type: text/xml' -X GET
curl -basic --url http://[site].bookingbug.com/api/service.xml -uusername:password -H 'Content-type: text/xml' -X GET -d "
<?xml version='1.0' encoding='UTF-8'?>
  <service>
    <company_id>id_of_sub_company</company_id>
  </service>
"

(for multiple sub-companies)

JSON

curl -basic --url http://[site].bookingbug.com/api/service.json -uusername:password -H 'Content-type: application/json' -X GET
curl -basic --url http://[site].bookingbug.com/api/service.json -uusername:password -H 'Content-type: application/json' -X GET -d "
{"service":{"company_id":id_of_sub_company}}
"

(for multiple sub-companies)

Get service

XML

curl -basic --url http://[site].bookingbug.com/api/service/[id_of_service].xml -uusername:password -H 'Content-type: text/xml' -X GET
curl -basic --url http://[site].bookingbug.com/api/service/[id_of_service].xml -uusername:password -H 'Content-type: text/xml'
-X GET -d "
<?xml version='1.0' encoding='UTF-8'?>
  <service>
    <company_id>id_of_sub_company</company_id>
  </service>
"

(for multiple sub-companies)

JSON

curl -basic --url http://[site].bookingbug.com/api/service/[id_of_service].json -uusername:password -H 'Content-type: application/json'
-X GET
curl -basic --url http://[site].bookingbug.com/api/service/[id_of_service].json -uusername:password
-H 'Content-type: application/json' -X GET -d "{"service":{"company_id":id_of_sub_company}}"

(for multiple sub-companies)

Create service

XML

curl -basic --url http://[site].bookingbug.com/api/service.xml -uusername:password -H 'Content-type:text/xml' -X POST -d "
<?xml version='1.0' encoding='UTF-8'?>
  <service>
    <name>Villa rent</name>
    <description>description of service</description>
    <service_type>0</service_type>
    <duration>60</duration>
    <duration_step>60</duration_step>
    <min_bookings>1</min_bookings>
    <max_bookings>1</max_bookings>
    <max_advance>60</max_advance>
    <min_book_days>0</min_book_days>
    <ask_address>true</ask_address>
    <spaces>1</spaces>
    <disabled>false</disabled>
    <pre_time>0</pre_time>
    <post_time>0</post_time>
    <price>10.0</price>
    <min_cancel>1</min_cancel>
    <category_id>3</category_id>
  </service>
"
curl -basic --url http://[site].bookingbug.com/api/service.xml -uusername:password -H 'Content-type:text/xml' -X POST -d "
<?xml version='1.0' encoding='UTF-8'?>
  <service>
    <company_id>id_of_sub_company</company_id>
    <name>Villa rent</name>
    <description>description of service</description>
    <service_type>0</service_type>
    <duration>60</duration>
    <duration_step>60</duration_step>
    <min_bookings>1</min_bookings>
    <max_bookings>1</max_bookings>
    <max_advance>60</max_advance>
    <min_book_days>0</min_book_days>
    <ask_address>true</ask_address>
    <spaces>1</spaces>
    <disabled>false</disabled>
    <pre_time>0</pre_time>
    <post_time>0</post_time>
    <price>10.0</price>
    <min_cancel>1</min_cancel>
    <category_id>3</category_id>
</service>
"

(for multiple sub-companies)

JSON

curl -basic --url http://[site].bookingbug.com/api/service.json -uusername:password -H Content-type:application/json -X POST -d "
{"service":{
  "name":"Villa rent",
  "description":"description of service",
  "service_type":0,
  "duration":60,
  "duration_step":60,
  "min_bookings":1,
  "max_bookings":1,
  "max_advance":60,
  "min_book_days":0,
  "ask_address":true,
  "spaces":1,
  "disabled":false,
  "pre_time":0,
  "post_time":0,
  "price":10.0,
  "min_cancel":1,
  "category_id":3
  }
}
"
curl -basic --url http://[site].bookingbug.com/api/service.json -uusername:password -H Content-type:application/json -X POST -d "
{"service":{
  "company_id":id_of_sub_company,
  "name":"Villa rent",
  "description":"description of service",
  "service_type":0,
  "duration":60,
  "duration_step":60,
  "min_bookings":1,
  "max_bookings":1,
  "max_advance":60,
  "min_book_days":0,
  "ask_address":true,
  "spaces":1,
  "disabled":false,
  "pre_time":0,
  "post_time":0,
  "price":10.0,
  "min_cancel":1,
  "category_id":3
 }
}
"

(for multiple sub-companies)

Update service

XML

curl -basic --url http://[site].bookingbug.com/api/person/[id_of_service].xml -uusername:password -H 'Content-type:text/xml'
-X PUT -d "
<?xml version='1.0' encoding='UTF-8'?>
  <service>
    <name>Villa rent</name>
    <description>description of service</description>
    <service_type>0</service_type>
    <duration>60</duration>
    <duration_step>60</duration_step>
    <min_bookings>1</min_bookings>
    <max_bookings>1</max_bookings>
    <max_advance>60</max_advance>
    <min_book_days>0</min_book_days>
    <ask_address>true</ask_address>
    <spaces>1</spaces>
    <disabled>false</disabled>
    <pre_time>0</pre_time>
    <post_time>0</post_time>
    <price>10.0</price>
    <min_cancel>1</min_cancel>
    <category_id>3</category_id>
  </service>
"
curl -basic --url http://[site].bookingbug.com/api/person/[id_of_service].xml -uusername:password -H 'Content-type:text/xml'
-X PUT -d "
<?xml version='1.0' encoding='UTF-8'?>
  <service>
    <company_id>id_of_sub_company</company_id>
    <name>Villa rent</name>
    <description>description of service</description>
    <service_type>0</service_type>
    <duration>60</duration>
    <duration_step>60</duration_step>
    <min_bookings>1</min_bookings>
    <max_bookings>1</max_bookings>
    <max_advance>60</max_advance>
    <min_book_days>0</min_book_days>
    <ask_address>true</ask_address>
    <spaces>1</spaces>
    <disabled>false</disabled>
    <pre_time>0</pre_time>
    <post_time>0</post_time>
    <price>10.0</price>
    <min_cancel>1</min_cancel>
    <category_id>3</category_id>
  </service>
"

(for mulitple sub-companies)

JSON

curl -basic --url http://[site].bookingbug.com/api/person/[id_of_service].json -uusername:password
-H Content-type:application/json -X PUT -d "
{"service":{
  "name":"Villa rent",
  "description":"description of service",
  "service_type":0,
  "duration":60,
  "duration_step":60,
  "min_bookings":1,
  "max_bookings":1,
  "max_advance":60,
  "min_book_days":0,
  "ask_address":true,
  "spaces":1,
  "disabled":false,
  "pre_time":0,
  "post_time":0,
  "price":10.0,
  "min_cancel":1,
  "category_id":3
 }
}
"
curl -basic --url http://[site].bookingbug.com/api/person/[id_of_service].json -uusername:password
-H Content-type:application/json -X PUT -d "
{"service":{
  "company_id":id_of_sub_company,
  "name":"Villa rent",
  "description":"description of service",
  "service_type":0,
  "duration":60,
  "duration_step":60,
  "min_bookings":1,
  "max_bookings":1,
  "max_advance":60,
  "min_book_days":0,
  "ask_address":true,
  "spaces":1,
  "disabled":false,
  "pre_time":0,
  "post_time":0,
  "price":10.0,
  "min_cancel":1,
  "category_id":3
 }
}
"

Delete service

XML

curl -basic --url http://[site].bookingbug.com/api/person/[id_of_service].xml -uusername:password -H Content-type:text/xml -X DELETE
curl -basic --url http://[site].bookingbug.com/api/person/[id_of_service].xml -uusername:password -H Content-type:text/xml
-X DELETE -d "
<?xml version='1.0' encoding='UTF-8'?>
  <service>
    <company_id>id_of_sub_company</company_id>
  </service>
"

JSON

curl -basic --url http://[site].bookingbug.com/api/person/[id_of_service].json -uusername:password
-H Content-type:application/json -X DELETE
curl -basic --url http://[site].bookingbug.com/api/person/[id_of_service].json -uusername:password
-H Content-type:application/json -X DELETE -d "
{"service":{
  "company_id":id_of_sub_company
 }
}
"