BookingBug REST API: resource
Purpose
Used for creating and editing resources. A resource represents a physical bookable object. This could anything from a room, a villa, a car, a bike, a court. Resources can be managed separately as single items, or a large number of identical resources can be configured together. These are used when a resource is 'fungible' i.e. that any one resource could be substituted for another, and the client has no advance knowledge of which one they are booking.
URL
http://[site].bookingbug.com/api/resource.format
json, xml
Authentication
Requies business API access
Parameters
| param | type | description | required? | default |
|---|---|---|---|---|
| name | string(50) | A resource name | Yes | |
| description | string(255) | A longer description of the resource if required | No | |
| string(60) |
An email address where any booking requests for this resource will be sent. Booking requests will be sent to the company default email address, so this is optional | No | ||
| address | address | An optional address or location for this resource. | No | |
| disabled | bool |
Lets you disabled this resource, such that it can no longer be booked. However if historical booking exist against this resource it cannot be fully deleted for data reference purposes | No | false |
| schedule | schedule | A schedule for this resource. Should contain either available days or hours if required. Each bookable item requires a schedule of some kind, either by person, service or resource. If a resource is used and no schedule is configured BookingBug will create a default availability schedule for the person as a first preference, then a resource if people are not being actively managed by this company, in the appropriate time range for the businesses if possible. A price shedule will required if the business is configured to offer 'price by time' and 'price by resource'. It could be a shared schedule which matches multiple resources. | No | false |
| price | decimal(8,2) | Optional single price information for this resource. If the business is set up to 'price by resource' but is using fixed pricing, then this price_group will contain information about the price of the resource. | No | - |
| never_booked | bool | Allows you to say that this resource is never marked as booked. If BookingBug is being used as an ancillary enquiry platform, or that the resource is not an exact representation of a real resource, you can allow the resource to be shown as always always available. This should be used with extreame caution as it does then not represent real availability to the user. | No | false |
| position | integer | An optional value that is used to sort multiple staff in a booking widget in a specific order | No | - |
| count |
integer | If using 'fungible' resources, this sets the number of resources available to be booked. Each booking uses is single resource. This should not be used in combination with a service with multiple spaces if possible or it gets very confusing! | No | 1 |
| public_ical | string | A URL for a publicly readable ical feed for this resource. Shows just free/busy times when existing bookings are made (read only) | No | - |
| private_ical | string | A URL for a 'private' ical feed. This shows full booking information for the resource, and should be used by the person to overlay into any existing calendar apps they us. This calendar should not be made publically available (read only) | No | - |
| max_book | integer | if this is a 'fungible' resource of which there are multiple-identical ones, you can allow the customer to book multiple resources for the same time in a single item. This allows you to configure the maximum number bookable | No | 1 |
Examples
Get List
XML
curl -basic --url http://[site].bookingbug.com/api/resource.xml -uusername:password -H 'Content-type: text/xml' -X GET
curl -basic --url http://[site].bookingbug.com/api/resource.xml -uusername:password -H 'Content-type: text/xml' -X GET -d "<?xml version='1.0' encoding='UTF-8'?><resource><company_id>id_of_sub_company</company_id></resource>"
(for multiple sub-companies)
JSON
curl -basic --url http://[site].bookingbug.com/api/resource.json -uusername:password -H 'Content-type: application/json' -X GET
curl -basic --url http://[site].bookingbug.com/api/resource.json -uusername:password -H 'Content-type: application/json' -X GET -d "{"resource":{"company_id":id_of_sub_company}}"
(for multiple sub-companies)
Get resource
XML
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].xml -uusername:password -H 'Content-type: text/xml' -X GET
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].xml -uusername:password -H 'Content-type: text/xml' -X GET -d " <?xml version='1.0' encoding='UTF-8'?> <resource> <company_id>id_of_sub_company</company_id> </resource> "
(for multiple sub-companies)
JSON
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].json -uusername:password
-H 'Content-type: application/json' -X GET
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].json -uusername:password -H 'Content-type: application/json' -X GET -d "{"resource":{"company_id":id_of_company}}"
(for multiple sub-companies)Create resource
XML
curl -basic --url http://[site].bookingbug.com/api/resource.xml -uusername:password -H 'Content-type:text/xml' -X POST -d " <?xml version='1.0' encoding='UTF-8'?> <resource> <name>Name of resource</name> <description>description resource</description> <email>resource@abc.com</email> <address> <address1>address 1 of resource</address1> <address2>address 2 of resource</address2> <address3>address 3 of resource</address3> <address4>address 4 of resource</address4> <postcode>12345</postcode> <country>United Kingdom</country> <email>test@abc.com</email> <mobile>+44 1234567</mobile> <phone>+44 1234567</phone> <name>name of address</name> </address> <disabled>false</disabled> <price>10.0</price> <never_booked>false</never_booked> <count>1</count> <max_book>1</max_book> </resource> "
curl -basic --url http://[site].bookingbug.com/api/resource.xml -uusername:password -H 'Content-type:text/xml' -X POST -d " <?xml version='1.0' encoding='UTF-8'?> <resource> <company_id>id_of_sub_company</company_id> <name>Name of resource</name> <description>description resource</description> <email>resource@abc.com</email> <address> <address1>address 1 of resource</address1> <address2>address 2 of resource</address2> <address3>address 3 of resource</address3> <address4>address 4 of resource</address4> <postcode>12345</postcode> <country>United Kingdom</country> <email>test@abc.com</email> <mobile>+44 1234567</mobile> <phone>+44 1234567</phone> <name>name of address</name> </address> <disabled>false</disabled> <price>10.0</price> <never_booked>false</never_booked> <count>1</count> <max_book>1</max_book> </resource> "
(for multiple sub-companies)
JSON
curl -basic --url http://[site].bookingbug.com/api/resource.json -uusername:password -H Content-type:application/json -X POST -d " {"resource":{ "name":"Name of resource", "description":"description of resource", "email":"resource@abc.com","address":{ "address1":"address 1 of resource", "address2":"address 2 of resource", "address3":"address 3 of resource", "address4":"address 4 of resource", "postcode":"12345", "country":"United Kingdom", "email":"test@abc.com", "mobile":"+44 1234567", "phone":"+44 1234567", "name":"name of address" }, "disabled":false, "price":10.0, "never_booked":false, "count":1, "max_book":1 } } "
curl -basic --url http://[site].bookingbug.com/api/resource.json -uusername:password -H Content-type:application/json -X POST -d " {"resource":{ "company_id":id_of_sub_company, "name":"Name of resource", "description":"description of resource", "email":"resource@abc.com", "address":{ "address1":"address 1 of resource", "address2":"address 2 of resource", "address3":"address 3 of resource", "address4":"address 4 of resource", "postcode":"12345", "country":"United Kingdom", "email":"test@abc.com", "mobile":"+44 1234567", "phone":"+44 1234567", "name":"name of address" }, "disabled":false, "price":10.0, "never_booked":false, "count":1, "max_book":1 } } "
(for multiple sub-companies)
Update resource
XML
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].xml -uusername:password -H 'Content-type:text/xml' -X PUT -d " <?xml version='1.0' encoding='UTF-8'?> <resource> <name>Name of resource</name> <description>description resource</description> <email>resource@abc.com</email> <address> <address1>address 1 of resource</address1> <address2>address 2 of resource</address2> <address3>address 3 of resource</address3> <address4>address 4 of resource</address4> <postcode>12345</postcode> <country>United Kingdom</country> <email>test@abc.com</email> <mobile>+44 1234567</mobile> <phone>+44 1234567</phone> <name>name of address</name> </address> <disabled>false</disabled> <price>10.0</price> <never_booked>false</never_booked> <count>1</count> <max_book>1</max_book> </resource> "
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].xml -uusername:password -H 'Content-type:text/xml' -X PUT -d " <?xml version='1.0' encoding='UTF-8'?> <resource> <company_id>id_of_sub_company</company_id> <name>Name of resource</name> <description>description resource</description> <email>resource@abc.com</email> <address> <address1>address 1 of resource</address1> <address2>address 2 of resource</address2> <address3>address 3 of resource</address3> <address4>address 4 of resource</address4> <postcode>12345</postcode> <country>United Kingdom</country> <email>test@abc.com</email> <mobile>+44 1234567</mobile> <phone>+44 1234567</phone> <name>name of address</name> </address> <disabled>false</disabled> <price>10.0</price> <never_booked>false</never_booked> <count>1</count> <max_book>1</max_book> </resource> "
JSON
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].json -uusername:password -H Content-type:application/json -X PUT -d " {"resource":{ "name":"Name of resource", "description":"description of resource", "email":"resource@abc.com", "address":{ "address1":"address 1 of resource", "address2":"address 2 of resource", "address3":"address 3 of resource", "address4":"address 4 of resource", "postcode":"12345", "country":"United Kingdom", "email":"test@abc.com", "mobile":"+44 1234567", "phone":"+44 1234567", "name":"name of address" }, "disabled":false, "price":10.0, "never_booked":false, "count":1, "max_book":1 } } "
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].json -uusername:password -H Content-type:application/json -X PUT -d " {"resource":{ "company_id":id_of_sub_company, "name":"Name of resource", "description":"description of resource", "email":"resource@abc.com", "address":{ "address1":"address 1 of resource", "address2":"address 2 of resource", "address3":"address 3 of resource", "address4":"address 4 of resource", "postcode":"12345", "country":"United Kingdom", "email":"test@abc.com", "mobile":"+44 1234567", "phone":"+44 1234567", "name":"name of address" }, "disabled":false, "price":10.0, "never_booked":false, "count":1, "max_book":1 } } "
Delete resource
XML
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].xml -uusername:password -H Content-type:text/xml -X DELETE
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].xml -uusername:password -H Content-type:text/xml -X DELETE -d " <?xml version='1.0' encoding='UTF-8'?> <resource> <company_id>id_of_sub_company</company_id> </resource> "
JSON
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].json -uusername:password
-H Content-type:application/json -X DELETE
curl -basic --url http://[site].bookingbug.com/api/resource/[id_of_resource].json -uusername:password -H Content-type:application/json -X DELETE -d "{"resource":{"company_id":id_of_sub_company}}"