Skip to content

Bookings API Reference

Bellow is a list of booking related endpoints along with their inputs and outputs. All API requests require a Bearer token. Refer to the Authentication section to see how to acquire one.

Note that parameers with an asterisk (*) at the end of their name are mandatory.

Make a new booking

Use this endpoint to make a new booking to a specific facility.

POST /api/bookings

Parameters

Name Type In Description
externalBookingId string body A reference ID owned by the client
correlationId string body A correlation ID to track a user session across multiple bookings
bayId* string body The ID of the bay to book
userAlias* string body An alias for the user that makes the booking
startDate* string body A UTC date of the start time of the booking
endDate* string body A UTC date of the end time of the booking

Response

Status: 201 Created
Location: <booking_uri>
{
  "id": "b683b97c-35de-4764-8eb6-0d5d49653d29",
  "externalBookingId": "B3212269",
  "correlationId": "d4151e2a-eeaa-471d-9e9e-4fba596433cb",
  "startDate": "2021-05-03T09:46:59.0274984Z",
  "endDate": "2021-05-03T10:46:59.0274984Z",
  "userAlias": "golf-master",
  "bayId": "6bed8066-3e02-4707-8c61-8dfde9455f3e",
  "createdAt": "2021-04-27T09:37:53.0816546",
  "lastUpdatedAt": "2021-04-27T09:37:53.0816546",
  "_links": {
    "self": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
    },
    "edit": {
      "method": "PUT",
      "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
    },
    "delete": {
      "method": "DELETE",
      "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
    }
  }
}

Validation failed

Status: 400 Bad Request
{
  "errors": [
    {
      "code": "ERR00001",
      "description": "'BayId' is mandatory",
      "moreInfo": "",
      "contextData": {
        "externalBookingId": ""
      }
    }
  ]
}
Error Code Description
ERR00001 '{fieldName}' is mandatory
ERR00010 'EndDate' cannot be before 'StartDate'
ERR00011 'EndDate' cannot be in the past
ERR00012 Could not find 'bay' with id '{id}'
BOOK00001 Cannot accept booking because another booking with the same external booking id already exists.
BOOK00002 The specified booking time overlaps with another booking
BOOK00003 The specified bay is not available for booking

Update a booking

Use this endpoint to update an existing booking.

PUT /api/bookings/{id}

Parameters

Name Type In Description
id string path The TrackMan Booking ID
bayId* string body The ID of the bay to book
userAlias* string body An alias for the user that makes the booking
startDate* string body A UTC date of the start time of the booking
endDate* string body A UTC date of the end time of the booking

Response

Status: 200 OK
{
  "id": "b683b97c-35de-4764-8eb6-0d5d49653d29",
  "externalBookingId": "B3212269",
  "correlationId": "d4151e2a-eeaa-471d-9e9e-4fba596433cb",
  "startDate": "2021-05-03T09:46:59.0274984Z",
  "endDate": "2021-05-03T10:46:59.0274984Z",
  "userAlias": "golf-master",
  "bayId": "6bed8066-3e02-4707-8c61-8dfde9455f3e",
  "createdAt": "2021-04-27T09:37:53.0816546",
  "lastUpdatedAt": "2021-04-27T09:37:53.0816546",
  "_links": {
    "self": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
    },
    "edit": {
      "method": "PUT",
      "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
    },
    "delete": {
      "method": "DELETE",
      "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
    }
  }
}

Validation failed

Status: 400 Bad Request
{
  "errors": [
    {
      "code": "ERR00001",
      "description": "'BayId' is mandatory",
      "moreInfo": "",
      "contextData": {
        "externalBookingId": ""
      }
    }
  ]
}
Error Code Description
ERR00001 '{fieldName}' is mandatory
ERR00010 'EndDate' cannot be before 'StartDate'
ERR00011 'EndDate' cannot be in the past
ERR00012 Could not find 'bay' with id '{id}'
BOOK00002 The specified booking time overlaps with another booking
BOOK00003 The specified bay is not available for booking

Delete a booking

Use this endpoint to delete an existing booking.

DELETE /api/bookings/{id}

Parameters

Name Type In Description
id string path The TrackMan Booking ID

Response

Status: 204 No Content

List all bookings

Use this endpoint to get a list of all the bookings the client has access to in a particular location.

GET /api/bookings?locationIds=5804d2a9-8f0c-4704-bd7c-c6ac455a7346

Parameters

Name Type In Description
ids string array query One or more TrackMan booking IDs
externalBookingIds string array query One or more external booking IDs
correlationIds string query One or more correlation IDs
bayIds string array query One or more bay IDs
locationIds* string array query One or more location IDs
userAlias string query The user alias to search for
isActive boolean query Only return future bookings
startDate datetime query Return bookings that are within the given start date. If startDate is given, then endDate is mandatory.
endDate datetime query Return bookings that are within the given end date. If endDate is given, then startDate is mandatory.

Response

Status: 200 OK
{
  "items": [
    { 
      "id": "b683b97c-35de-4764-8eb6-0d5d49653d29",
      "externalBookingId": "B3212269",
      "correlationId": "d4151e2a-eeaa-471d-9e9e-4fba596433cb",
      "startDate": "2021-05-03T09:46:59.0274984Z",
      "endDate": "2021-05-03T10:46:59.0274984Z",
      "userAlias": "golf-master",
      "bayId": "6bed8066-3e02-4707-8c61-8dfde9455f3e",
      "createdAt": "2021-04-27T09:37:53.0816546",
      "lastUpdatedAt": "2021-04-27T09:37:53.0816546",
      "_links": {
        "self": {
          "method": "GET",
          "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
        },
        "edit": {
          "method": "PUT",
          "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
        },
        "delete": {
          "method": "DELETE",
          "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
        }
      }
    }
  ],
  "_links": {
    "self": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/bookings?locationIds=5804d2a9-8f0c-4704-bd7c-c6ac455a7346"
    },
    "first": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/bookings?locationIds=5804d2a9-8f0c-4704-bd7c-c6ac455a7346"
    },
    "last": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/bookings?locationIds=5804d2a9-8f0c-4704-bd7c-c6ac455a7346"
    }
  },
  "page": 1,
  "pageSize": 50,
  "pageCount": 1,
  "total": 1
}

Get a single booking

Use this endpoint to retrieve a single booking by its ID.

GET /api/bookings/{id}

Parameters

Name Type In Description
id string path The TrackMan Booking ID

Response

Status: 200 OK
{
  "id": "b683b97c-35de-4764-8eb6-0d5d49653d29",
  "externalBookingId": "B3212269",
  "correlationId": "d4151e2a-eeaa-471d-9e9e-4fba596433cb",
  "startDate": "2021-05-03T09:46:59.0274984Z",
  "endDate": "2021-05-03T10:46:59.0274984Z",
  "userAlias": "golf-master",
  "bayId": "6bed8066-3e02-4707-8c61-8dfde9455f3e",
  "createdAt": "2021-04-27T09:37:53.0816546",
  "lastUpdatedAt": "2021-04-27T09:37:53.0816546",
  "_links": {
    "self": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
    },
    "edit": {
      "method": "PUT",
      "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
    },
    "delete": {
      "method": "DELETE",
      "href": "https://api.trackmanrange.com/api/bookings/b683b97c-35de-4764-8eb6-0d5d49653d29"
    }
  }
}

List all booking locations

Use this endpoint to get a list of all the available booking locations the client has access to.

GET /api/booking-locations

Parameters

Name Type In Description
ids string array query One or more location IDs
facilityIds string array query One or more facility IDs

Response

Status: 200 OK
{
  "items": [
    {
      "id": "5804d2a9-8f0c-4704-bd7c-c6ac455a7346",
      "name": "Test Location 1",
      "_links": {
        "self": {
          "method": "GET",
          "href": "https://api.trackmanrange.com/api/booking-locations/5804d2a9-8f0c-4704-bd7c-c6ac455a7346"
        },
        "bays": {
          "method": "GET",
          "href": "https://api.trackmanrange.com/api/booking-bays?locationId=5804d2a9-8f0c-4704-bd7c-c6ac455a7346"
        }
      }
    },
    {
      "id": "66aa4df9-ed58-4ff5-ae30-351486167d67",
      "name": "Test Location 2",
      "_links": {
        "self": {
          "method": "GET",
          "href": "https://api.trackmanrange.com/api/booking-locations/66aa4df9-ed58-4ff5-ae30-351486167d67"
        },
        "bays": {
          "method": "GET",
          "href": "https://api.trackmanrange.com/api/booking-bays?locationId=66aa4df9-ed58-4ff5-ae30-351486167d67"
        }
      }
    }
  ],
  "_links": {
    "self": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/booking-locations"
    },
    "first": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/booking-locations"
    },
    "last": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/booking-locations"
    }
  },
  "page": 1,
  "pageSize": 500,
  "pageCount": 1,
  "total": 2
}

Get booking location by ID

Use this endpoint to get a booking location by it's ID.

GET /api/booking-locations/{id}

Parameters

Name Type In Description
id string path The location ID

Response

Status: 200 OK
{
  "id": "5804d2a9-8f0c-4704-bd7c-c6ac455a7346",
  "name": "Test Location 1",
  "_links": {
    "self": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/booking-locations/5804d2a9-8f0c-4704-bd7c-c6ac455a7346"
    },
    "bays": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/booking-bays?locationId=5804d2a9-8f0c-4704-bd7c-c6ac455a7346"
    }
  }
}

List all booking bays at a location

Use this endpoint to get a list of all the available booking bays at the specified location.

GET /api/booking-bays?locationId=5804d2a9-8f0c-4704-bd7c-c6ac455a7346

Parameters

Name Type In Description
locationId string query The location ID

Response

Status: 200 OK
{
  "items": [
    {
      "id": "70e91c70-538f-416e-a4db-b239c16f86c6",
      "name": "Bay 1",
      "description": "Bay 1",
      "kind": "RangeBay",
      "location": {
        "id": "5804d2a9-8f0c-4704-bd7c-c6ac455a7346",
        "name": "Test Location 1"
      },
      "_links": {}
    },
    {
      "id": "1cebd72e-64cf-4108-aee2-f525bbd2c179",
      "name": "Bay 2",
      "description": "Bay 2",
      "kind": "RangeBay",
      "location": {
        "id": "5804d2a9-8f0c-4704-bd7c-c6ac455a7346",
        "name": "Test Location 1"
      },
      "_links": {}
    },
    {
      "id": "3d84939e-ae33-4b81-ab18-626db5ec46ae",
      "name": "Bay 3",
      "description": "Bay 3",
      "kind": "RangeBay",
      "location": {
        "id": "5804d2a9-8f0c-4704-bd7c-c6ac455a7346",
        "name": "Test Location 1"
      },
      "_links": {}
    },
    {
      "id": "34715aeb-6b05-4573-8d93-56e3a9ca373f",
      "name": "Bay 4",
      "description": "Bay 4",
      "kind": "RangeBay",
      "location": {
        "id": "5804d2a9-8f0c-4704-bd7c-c6ac455a7346",
        "name": "Test Location 1"
      },
      "_links": {}
    },
    {
      "id": "23c441a9-6ea0-47bd-ac6f-a5e39c0f587d",
      "name": "Bay 5",
      "description": "Bay 5",
      "kind": "RangeBay",
      "location": {
        "id": "5804d2a9-8f0c-4704-bd7c-c6ac455a7346",
        "name": "Test Location 1"
      },
      "_links": {}
    }
  ],
  "_links": {
    "self": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/booking-bays?LocationId=5804d2a9-8f0c-4704-bd7c-c6ac455a7346"
    },
    "first": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/booking-bays?LocationId=5804d2a9-8f0c-4704-bd7c-c6ac455a7346"
    },
    "last": {
      "method": "GET",
      "href": "https://api.trackmanrange.com/api/booking-bays?LocationId=5804d2a9-8f0c-4704-bd7c-c6ac455a7346"
    }
  },
  "page": 1,
  "pageSize": 1000,
  "pageCount": 1,
  "total": 5
}