JSON Feed

A JSON feed is available for all publicly available information in a format that web developers can consume and create a website that displays all products, details and availability.

Caching

The data can be requested as often as you like, however to prevent over use we cache the data and it isn't updated within at 5 minutes.

Limits

If the data requested contains too many objects, then you will be informed 'Data cannot be handled.'. This restriction is normally only triggered if you have many locations and many events or you are requesting all data.

Feed types

There are two types of feed - reference data and availability. The reference data are products, staff members, etc - things which don't change their details minute by minute and is intended to be called in frequently. The availability is changing minute by minute and is designed to called frequently.

Reference Data (no extra parameters)

http://demo.bookinglive.com/jsonfeed/refdata

This returns all the ref data that the system uses...

{
    "DateTime": "2016-02-25 08:23:56",
    "Products": [
        {
            "id": 1,
            "name": "Term Time Tennis",
            "description": "Play Tennis.",
            "classname": "ProductFixedEvent",
            "price_type": "perperson",
            "price": "10.00",
            "booking_view": null,
            "membership_group_id": null,
            "product_pricing": [],
            "product_group_ids": [
                "1"
            ],
            "for_sale_on": null,
            "resource_id": "55"
        },
        {
            "id": 2,
            "name": "Easter Holiday Camp",
            "description": "Enjoy our holiday camp",
            "classname": "ProductFixedEvent",
            "price_type": "perperson",
            "price": "32.00",
            "booking_view": "SevenDayMultiSelectView",
            "membership_group_id": null,
            "product_pricing": [],
            "product_group_ids": [
                "2"
            ],
            "for_sale_on": null,
            "resource_id": "55"
        },
        {
            "id": 3,
            "name": "Library Booking",
            "description": "This product covers all resource bookings from the library",
            "classname": "ProductResource",
            "price_type": "perperson",
            "price": "0.00",
            "booking_view": "Calendar",
            "membership_group_id": null,
            "product_pricing": [],
            "product_group_ids": [],
            "for_sale_on": null,
            "resources": [
               "1",
               "2",
               "3",
               "4",
            ],
        },
    ],
    "ProductPricing": [
        {
            "id": 1,
            "name": "Standard",
            "displayname": "Standard",
            "price": "15.00",
            "product_id": "1"
        },
        {
            "id": 2,
            "name": "Professional",
            "displayname": "Professional",
            "price": "33.00",
            "product_id": "1"
        }
    ],
    "ProductGroup": [
        {
            "id": 1,
            "name": "Term Time"
        },
        {
            "id": 2,
            "name": "Holiday Camps"
        }
    ],
    "Resources": [
        {
            "id": 1,
            "name": "Sports Hall",
            "location": "1",
            "provider_id": 1,
            "tags": [],
            "current_stock_level":null
        },
        {
            "id": 2,
            "name": "Swimming Pool",
            "location": "1",
            "provider_id": 1,
            "tags": [],
            "current_stock_level":null
        },
        {
            "id": 3,
            "name": "Playing Fields",
            "location": "1",
            "provider_id": 1,
            "tags": [],
            "current_stock_level":null
        },
        {
            "id": 4,
            "name": "Leaflet",
            "location": "1",
            "provider_id": 1,
            "tags": [
               "leaflet",
               "health",
            ],
            "current_stock_level":"500"
        }
    ],
    "ResourceProviders": [
        {
            "id": 1,
            "name": "Leaflet Provider",
            "firstname": "John",
            "lastname": "Brown",
            "phonenumber": "0129384756",
            "mobile": "0192837465",
            "address": {
                "housenumber": "10",
                "street": "Victoria",
                "county": "Somerset",
                "town": "Bristol",
                "postcode": "BS8 1TJ",
                "countrycode": "GB",
                "longitude": "0",
                "latitude": "0",
                "streetview": null
            }
        }
    ],
    "Locations": [
        {
            "id": 1,
            "name": "My Location",
            "address": {
                "housenumber": 123,
                "street": "Nutshell Road",
                "county": "Hampshire",
                "town": "Rindown",
                "postcode": "RG28 1PB",
                "countrycode": 'GB',
                "longitude": "0",
                "latitude": "0",
                "streetview": null
            }
        }
    ],
    "StaffMembers": [
        {
            "id": 5,
            "firstname": "Mark",
            "surname": "Grapes"
        },
        {
            "id": 6,
            "firstname": "Deborah",
            "surname": "Jefferies"
        }
    ]
}

Availability

The main availability functions are for [[ObjectName::ProductFixedEvent]] and [[ObjectName::ProductEventSeries]].
There is an additional functions one for [[ObjectName::ProductTemplateEvents]] and another for [[ObjectName::ProductResource]].

Product Availability (2 to 3 parameters)

This returns data for either ALL time, a MONTH or a RANGE - if no params then for ALL time. This feed is designed to provide as much data as possible in "month" chunks with relevant products availability broken down within that.

If the first param is a integer then this is taken to be a specific Product ID to retrieve the information for. Following that there can be one or two date fields (both in YYYY-MM-DD format). If one then it uses this to indicate the month, if two then this indicates a date range.

 remember in all cases this will return a months range of data.

There is a maximum number of results we share per request, if the number of results is much larger than this then they need to request again but with a smaller range.

Examples

{
    "2016 April": {
        "product_id_12_availability": [
            {
                "id": 143,
                "start_date_time": "2016-04-01 08:00:00",
                "end_date_time": "2016-04-01 16:00:00",
                "resource_id": "5",
                "capacity": "32",
                "available_spaces": 32,
                "staff_member_ids": []
            },
            {
                "id": 144,
                "start_date_time": "2016-04-04 08:00:00",
                "end_date_time": "2016-04-04 16:00:00",
                "resource_id": "5",
                "capacity": "32",
                "available_spaces": 32,
                "staff_member_ids": []
            }
        ]
    },
    "2016 May": {
        "product_id_15_availability": [
            {
                "id": 189,
                "start_date_time": "2016-05-31 08:00:00",
                "end_date_time": "2016-05-31 16:00:00",
                "resource_id": "5",
                "capacity": "32",
                "available_spaces": 32,
                "staff_member_ids": []
            }
        ]
    },
    "2016 June": {
        "product_id_15_availability": [
            {
                "id": 190,
                "start_date_time": "2016-06-01 08:00:00",
                "end_date_time": "2016-06-01 16:00:00",
                "resource_id": "5",
                "capacity": "32",
                "available_spaces": 32,
                "staff_member_ids": []
            },
            {
                "id": 191,
                "start_date_time": "2016-06-02 08:00:00",
                "end_date_time": "2016-06-02 16:00:00",
                "resource_id": "5",
                "capacity": "32",
                "available_spaces": 32,
                "staff_member_ids": []
            },
            {
                "id": 192,
                "start_date_time": "2016-06-03 08:00:00",
                "end_date_time": "2016-06-03 16:00:00",
                "resource_id": "5",
                "capacity": "32",
                "available_spaces": 32,
                "staff_member_ids": []
            }
        ]
    }
}

Single Date Product Availability (2 parameters)

Very similar to the above, except that it takes fewer parameters, has a smaller scope and provides less data back.
This is used when a single product and date is all the information required.

Example

{
    "Events": [{
        "id": 145,
        "start_date_time": "2016-04-05 08:00:00",
        "end_date_time": "2016-04-05 12:00:00",
        "resource_id": "5",
        "capacity": "32",
        "available_spaces": 32,
        "staff_member_ids": []
    }, {
        "id": 145,
        "start_date_time": "2016-04-05 12:00:00",
        "end_date_time": "2016-04-05 16:00:00",
        "resource_id": "5",
        "capacity": "32",
        "available_spaces": 32,
        "staff_member_ids": []
    }]
}

[[WIP]]

Resource Product Availability (3 parameters)

Returns data that contains availability and bookings data.
Availability contains set of date ranges for a specific product that indicate when this resource is available.
Bookings contains set of date ranges when resources has been booked and what was the quantity.
Both data (availability and bookings) are required to work out the actual stock availability for a specific resource within customer selected date range.


Feed URL

http://demo.bookinglive.com/jsonfeed/resourceproductavailability


Parameters

Parameter 1:
List of Resource ID's in the system seperated by comma sign, eg. "1,2,8,9"

Next two parameters define the date range of the requested availability to be checked.

Parameter 2: Start Date (format YYYY-MM-DD)
Parameter 3: End Date (format YYYY-MM-DD)


Example Request

resources with ID's 1, 2, 8 and 9 for 1st Jan to 1st Feb 2016

resource ID 1, for 1st Jan to 1st Feb 2016


Example Response
{
    "availability": [{
        "id": "14555",
        "start_date_time": "2016-01-01 00:00:00",
        "end_date_time": "2016-01-15 00:00:00",
        "resource_id": "1",
        "product_id": "1"
    }, {
        "id": "14556",
        "start_date_time": "2016-01-01 00:00:00",
        "end_date_time": "2016-02-01 00:00:00",
        "resource_id": "2",
        "product_id": "1"
    }],
    "bookings": [{
        "id": "14711",
        "start_date_time": "2016-01-04 10:00:00",
        "end_date_time": "2016-01-15 20:00:00",
        "resource_id": "1",
        "product_id": "1",
        "quantity": "100"
    }, {
        "id": "14712",
        "start_date_time": "2016-01-01 10:00:00",
        "end_date_time": "2016-01-08 20:00:00",
        "resource_id": "1",
        "product_id": "3",
        "quantity": "200"
    }]
}

Page last modified: September 20, 2018