For full functionality of this site it is necessary to enable JavaScript. Here are the instructions how to enable JavaScript in your web browser.
 You are using an out of date browser, we suggest you upgrade. You may continue if you wish, but aspects of the site may not function correctly.

Resources

The resource API enables you to list, create, update and delete the resources against your company. You must be authenticated as an administrator to perform the creation, update, delete and block time for resource.

Create Resource

The API enables an admin to create a resource. The following parameters listed below are supported.

Parameters

Name Type Description
name string Name of the resource
description string description for resource
email string email address of the resource
disbaled boolean true/false - false by default
price integer Price for resource to be booked
position integer Position of resource
never_booked boolean mark resource as never being booked
count integer Count
max_book integer Maximum times resource can be booked
api_ref string External reference for resource
address[address1] string Address line 1
address[address2] string Address line 2
address[address3] string Address line 3
address[address4] string Address line 4
address[address5] string Address line 5
address[postcode] string Postcode
address[country] string Country e.g. United Kingdom
address_id integer Address ID
POST /api/v1/admin/{company_id}/resources
curl -X POST -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {auth-token}"
  -H "Content-Type: application/json"
  -H "Cache-Control: no-cache"
  -d '{
    "name": "Consultation room 1",
    "description": "Consultation room 1",
    "email": "room1@email.com",
    "disabled": false,
    "price": 35,
    "never_booked": false,
    "max_book": 1,
    "api_ref": "roomSR1",
    "address": {
        "address1": "Pet Store",
        "address2": "123 Some Street",
        "address3": "Address line 3",
        "address4": "London",
        "postcode": "E12 8YH",
        "country": "United Kingdom"
    }
}'
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/resources"

Above is an example cURL call for creating a new resource with an address. When adding an address whilst creating a new resource, you'll need to find the address_id in the response and make another API call to the address end-point to view the address or alternatively you can grab the address link in the response.

Update Resource

You can update information of a resource. The parameters stated above can be used. You must be authenticated as an administrator to make this call.

PUT /api/v1/admin/{company_id}/resources/{id}
curl -X PUT -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {auth-token}"
  -H "Content-Type: application/json"
  -H "Cache-Control: no-cache"
  -d '{
    "name": "Consultation room 1",
    "description": "Consultation room 1",
    "email": "room1@email.com",
    "disabled": false,
    "price": 35,
    "never_booked": false,
    "max_book": 1,
    "api_ref": "roomSR12",
    "address": {
        "address1": "Pet Store",
        "address2": "123 Some Street",
        "address3": "Address line 3",
        "address4": "London",
        "postcode": "E12 8YH",
        "country": "United Kingdom"
    }
}'
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/resources/{id}"

List Resources

There are two different ways of listing resources. The first method is using the admin end-point and the second method is using the public end-point. The admin method of listing will return more data compared to the public.

Parameters

Name Type Description
page integer 1
per_page integer 300
GET /api/v1/admin/{company_id}/resources
GET /api/v1/{company_id}/resources
curl -X GET -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {auth-token}"
  -H "Content-Type: application/json"
  -H "Cache-Control: no-cache"
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/resource?page=1&per_page=50"
{
    "total_entries": 1,
    "_embedded": {
        "resources": [
            {
                "id": 13,
                "name": "Consultation room 1",
                "description": "Consultation room",
                "type": "resource",
                "deleted": false,
                "disabled": false,
                "company_id": {company_id},
                "email": "room1@email.com",
                "order": 13,
                "address_id": 6,
                "_links": {
                    "self": {
                        "href": "https://{host}.bookingbug.com/api/v1/admin/{company_id}/resources/13"
                    },
                    "items": {
                        "href": "https://{host}.bookingbug.com/api/v1/admin/{company_id}/items?resource_id=13"
                    },
                    "images": {
                        "href": "https://{host}.bookingbug.com/api/v1/{company_id}/media/resource_images/13"
                    },
                    "address": {
                        "href": "https://{host}.bookingbug.com/api/v1/admin/{company_id}/addresses/6"
                    },
                    "edit": {
                        "href": "https://{host}.bookingbug.com/api/v1/admin/{company_id}/resources/13/edit"
                    },
                    "block": {
                        "href": "https://{host}.bookingbug.com/api/v1/admin/{company_id}/resources/13/block"
                    },
                    "schedule": {
                        "href": "https://{host}.bookingbug.com/api/v1/admin/{company_id}/schedules/48351{?start_date,end_date}",
                        "templated": true
                    },
                    "enabled_services": [],
                    "enabled_people": []
                },
                "schedule_id": 48351,
                "service_ids": [],
                "person_ids": []
            }
        ]
    },
    "_links": {
        "self": {
            "href": "https://{host}.bookingbug.com/api/v1/admin/{company_id}/resources"
        },
        "new": {
            "href": "https://{host}.bookingbug.com/api/v1/admin/{company_id}/resources/new",
            "templated": true
        }
    }
}
{
    "total_entries": 1,
    "_embedded": {
        "resources": [
            {
                "id": 13,
                "name": "Consultation room 1",
                "description": "Consultation room",
                "type": "resource",
                "deleted": false,
                "disabled": false,
                "company_id": {company_id},
                "email": "room1@email.com",
                "order": 13,
                "address_id": 6,
                "_links": {
                    "self": {
                        "href": "https://{host}.bookingbug.com/api/v1/{company_id}/resources/13"
                    },
                    "items": {
                        "href": "https://{host}.bookingbug.com/api/v1/{company_id}/items?resource_id=13"
                    },
                    "images": {
                        "href": "https://{host}.bookingbug.com/api/v1/{company_id}/media/resource_images/13"
                    },
                    "address": {
                        "href": "https://{host}.bookingbug.com/api/v1/{company_id}/addresses/6"
                    }
                }
            }
        ]
    },
    "_links": {
        "self": {
            "href": "https://{host}.bookingbug.com/api/v1/{company_id}/resources"
        }
    }
}

The above is an admin cURL call for listing all resources 50 per page.

Read Resource

The resource read method enables you to view a particular resource's information. Once again there are two different ways, the admin and the public.

GET /api/v1/admin/{company_id}/resources/{id}
GET /api/v1/{company_id}/resources/{id}
curl -X GET -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {auth-token}"
  -H "Content-Type: application/json"
  -H "Cache-Control: no-cache"
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/resources/{id}"

Above is an example admin cURL call for reading a resource.

Delete Resource

You can delete a resource using the API method below.

DELETE /api/v1/admin/{company_id}/resources/{id}
curl -X DELETE -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {auth-token}"
  -H "Content-Type: application/json"
  -H "Cache-Control: no-cache"
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/resources/{id}"

Block time for resource

You can block a time slot for a resource in their calendar. The following parameters are required start_time and end_time.

PUT /api/v1/admin/{company_id}/resources/{id}/block
curl -X GET -H "App-Id: {app-id}" -H "App-Key: {app-key}" -H "Auth-Token: {token-token}"
  -H "Content-Type: application/json"
  -H "Cache-Control: no-cache"
  -d '{
      "start_time": "2017-09-07T11:00:00",
    "end_time": "2017-09-07T12:00:00"
  }'
"https://{host}.bookingbug.com/api/v1/admin/{company_id}/resource/{id}/block"
{
    "id": 22,
    "datetime": "2017-09-07T12:00:00+01:00",
    "end_datetime": "2017-09-07T13:00:00+01:00",
    "full_describe": "Person - Staff One",
    "status": 3,
    "spaces_booked": 0,
    "spaces_reserved": 0,
    "spaces_blocked": 1,
    "num_spaces": 1,
    "spaces_wait": 0,
    "person_id": 15288,
    "duration": 60,
    "duration_span": 3600,
    "company_id": 37004,
    "_links": {
        "self": {
            "href": "https://host.bookingbug.com/api/v1/admin/37004/slots/22"
        },
        "person": {
            "href": "https://host.bookingbug.com/api/v1/admin/37004/resource/15288"
        },
        "bookings": {
            "href": "https://host.bookingbug.com/api/v1/admin/37004/bookings?slot_id=22"
        },
        "booking_details": {
            "href": "https://host.bookingbug.com/api/v1/admin/37004/booking_details/?slot_id=22"
        }
    }
}

Above is an example admin cURL call blocking time for a given staff from 11am to 12pm on 7th September 2017.