# Overview of Bookings API Calls

HTML version: [Overview of Bookings API Calls](https://support.gladstonesoftware.cloud/api-integrations/overview-of-bookings-api-calls)

## Problem
Users need an overview of the available API methods for handling bookings, cancellations, activity retrieval, and pricing in the Bookings.asmx service.

## Resolution

Below are the key API calls available in Bookings.asmx and their functions:

1. **CancelBooking(int memberId, int bookingId, bool returnUsage)**
   - Cancels a booking for a member if allowed by business rules.
   - If more than one member is associated, only the specified member is removed; the booking remains for others.
   - If the booking used a usage subscription, the `returnUsage` parameter determines if the usage should be added back.
   - **Note:** This method will be deprecated in favour of `CancelBookingWithDetails()`.

2. **CancelBookingWithDetails(int memberId, int bookingId, Boolean returnUsage)**
   - Similar to `CancelBooking` but with additional reason reporting.

3. **GetActivitiesAtSite(obj request)**
   - Retrieves details of activities, classes, and courses at one or more sites.

4. **GetActivityDetails(string activityId)**
   - Retrieves details of a specific activity, including its group and linked resource products.

5. **GetActivityGroupDetails(obj request)**
   - Retrieves details for one or more activity groups.

6. **GetActivityGroups(string siteId, bool webBookableOnly)**
   - Retrieves a list of activity groups for a site, optionally filtered for web-bookable groups.

7. **GetAvailableBookableSlots(obj request)**
   - Returns bookable slots with prices for a given activity within a time range for a given member.
   - If `memberId` is 0, returns slots for non-members.
   - Does not support classes or courses.

8. **GetAvailableSlots(string activityId, DateTime startDateTime, DateTime endDateTime, int memberId)**
   - Returns bookable slots for an activity/class within a time range for a member or non-member.

9. **GetAvailableSlotsForProduct(string activityId, DateTime startDateTime, DateTime endDateTime, int memberId, string[] productIds)**
   - Returns bookable slots for an activity within a time range for a member or non-member, including specific resource product(s).
   - Specify required product IDs for bookings needing them (e.g., specific court, staff member).

10. **GetBookingSheet(BookingSheet BookingSheetRequest)**
    - Returns information on activities and reservations in the Booking sheet.
    - Four levels of detail: SummaryMergedSlots, Summary, PublicDetail, PrivateDetail.
    - Large data returns possible; check with Plus2 operator for appropriate time ranges.

11. **GetResourceProducts(string resourceGroupId)**
    - Retrieves resource product IDs for a specific resource group.
    - **Note:** Will be deprecated in favour of `GetProductsByProductGroups()`.

12. **GetZeroPricedAvailableSlots(string activityId, DateTime startDateTime, DateTime endDateTime, int memberId)**
    - Returns only the free slots a member can book, similar to `GetAvailableSlots`.

13. **GetZeroPricedAvailableSlotsForProduct(string activityId, DateTime startDateTime, DateTime endDateTime, int memberId, string[] productIds)**
    - Returns only the free slots for specific resource product(s), similar to `GetAvailableSlotsForProduct`.

14. **ListBookableActivitiesClassesCourses(int memberId, string siteId, bool webBookableOnly)**
    - Returns an array of bookable activities, classes, and courses for the specified member and site(s).
    - Use memberId 0 for non-members; site ID can be empty for all sites, or comma-separated for multiple sites.

15. **ListBookableActivitiesClassesCoursesByDate(int memberId, string siteId, bool webBookableOnly, DateTime[] dates)**
    - Returns all bookable activities, classes, and courses available to a member on specified dates.

16. **ListBookableActivitiesClassesCoursesByDateAndGroup(int memberId, string siteId, string activityGroupId, bool webBookableOnly, DateTime[] dates)**
    - Returns bookable activities, classes, and courses for specified dates and activity group.

17. **ListZeroPricedActivitiesByDateAndGroup(int memberId, string siteId, string activityGroupId, bool webBookableOnly, DateTime[] dates)**
    - Same as above, but only returns activities that can be booked for free.

18. **ListZeroPricedBookableActivitiesClassesCoursesByDate(int memberId, string siteId, bool webBookableOnly, DateTime[] dates)**
    - Returns only free slots for activities available on specific dates.

19. **MakeBooking(string activityId, DateTime startDateTime, int memberId)**
    - Makes a booking for a member for the given activity at the given time.
    - Returns booking ID for success or 0 if the booking cannot be made.

20. **MakeBookingForProduct(string activityId, DateTime startDateTime, int memberId, string[] productIds)**
    - Like `MakeBooking`, but lets you specify required resource products (e.g., choosing a court).

21. **MakeZeroPricedBooking(string activityId, DateTime startDateTime, int memberId)**
    - As above but only succeeds if the member can book the activity for free at that time.

22. **MakeZeroPricedBookingForProduct(string activityId, DateTime startDateTime, int memberId, string[] productIds)**
    - As above but for resource product bookings that are free for the member.

23. **RetrieveBookingPrice(string activityId, DateTime startDateTime, int memberId)**
    - Returns the price to be charged for the booking at a given time.

24. **RetrieveBookingPriceForProduct(string activityId, DateTime startDateTime, int memberId, string[] productIds)**
    - Like above, but for bookings requiring specific resource products (e.g., a court or staff member).

## Notes

- Some methods are planned for deprecation; use the recommended alternative methods where indicated.
- For methods returning potentially large amounts of booking data (such as `GetBookingSheet`), coordinate with the operator regarding appropriate time ranges to avoid excessive data returns.
- In all methods, use `memberId` of `0` to represent non-members.
- When bookings require selection of a specific resource (e.g., court, staff), include the appropriate resource product IDs.
