# Time Slot API

October 18, 2024

The Time Slot API is related to time slots that are available for time slots that are created and managed on the AnyRoad Platform. This endpoint will allow you to retrieve details about all of the time slots associated with an experience.

# Key Terminology

## Experience Time Slot Collection Resource

The time slot collection resource is a collection of time slot item resources. The time slot collection resource contains a block of pagination attributes and a collection of items.

### Pagination

|     |     |
| --- | --- |
| ```<br>attribute<br>``` | ```<br>Description<br>``` |
| **url - string($url)** | url of current page |
| **next_url - string($url)** | url of next page in paginated list |
| **previous_url - string($url)** | url of previous page in paginated list |
| **first_url - string($url)** | url of first page in paginated list |

### Collection of Experience Items

|     |     |
| --- | --- |
| ```<br>attribute<br>``` | ```<br>Description<br>``` |
| **items** | Collection of experience item resources |

## Experience Time Slot Item Resource

The experience time slot item resource contains all of the details about the time slots available for an experience.

## Query Date/Date Range

For endpoints with date parameters, the endpoint can be queried with a single date value, or a date range using the following conditionals inside square brackets on the query parameter.

|     |     |     |
| --- | --- | --- |
| ```<br>Format<br>``` | ```<br>Description<br>``` | ```<br>Example<br>``` |
| **gt - string($date-time)** | Greater than date | created[gt]=2022-02-26T23:59:00Z |
| **gte - string($date-time)** | Greater than or equal to date<br> | created[gte]=2022-02-26T23:59:00Z<br> |
| **lt - string($date-time)** | Less than date<br> | created[lt]=2022-02-26T23:59:00Z<br> |
| **lte - string($date-time)** | Less than or equal to date | created[lte]=2022-02-26T23:59:00Z |

# Endpoints

## Get Experience Time Slot Collection

You can retrieve a list of the time slots for a given experience by invoking the time slot endpoint with the the experience_id as a URL path parameter.

### URL:

[https://app.anyroad.com/external/api/v1/experiences/{experience_id}/time-slots](https://app.anyroad.com/external/api/v1/experiences/%7Bexperience_id%7D/time-slots)

### Query Parameters

|     |     |     |
| --- | --- | --- |
| ```<br>Param<br>``` | ```<br>Description<br>``` | ```<br>Example<br>``` |
| **limit - integer** | Limit result set to x records | 10 |
| **created** | Timestamp when record was created | created[gte]=2022-02-26T23:59:00Z |
| **updated** | Timestamp when record was updated | updated[gte]=2022-02-26T23:59:00Z |
| **local_date** | Search based on the date of a time slot on an experience using the local timezone configured on a particular experience (If no timezone is set explicitly on an experience the timezone defaults to America/Los Angeles). | local_date=2022-02-26T23:59:00Z |

### Example Request:

```
curl -XGET -H 'X-API-KEY: ' 'https://app.anyroad.com/external/api/v1/experiences/12345/time-slots'
```

### Example Responses:

#### 200 - List Response

```
{
  "url": "string",
  "next_url": "string",
  "previous_url": "string",
  "first_url": "string",
  "items": [
    {
      "local_datetime_start": "2024-01-08T22:15:10.452Z",
      "local_datetime_end": "2024-01-08T22:15:10.452Z",
      "timezone": "string",
      "capacity": 0,
      "available": 0,
      "duration": 0,
      "status": "open",
      "id": "string",
      "created": "2024-01-08T22:15:10.452Z",
      "updated": "2024-01-08T22:15:10.452Z",
      "url": "string"
    }
  ]
}
```

#### 400 - Bad Input Parameter

```
{
  "type": "https://example.com/error-type",
  "title": "Incorrect parameters provided",
  "status": 400,
  "detail": "limit value 'abc' must be an integer",
  "code": "limit_out_of_range",
  "instance": "/path",
  "request_id": "5f7e0797-7a42-4807-afaa-3efb80c8423a"
}
```

#### 401 - Unauthorized

```
{
  "type": "https://example.com/error-type",
  "title": "Authorization token invalid",
  "status": 401,
  "detail": "please verify your authorization token is correct and has not expired",
  "code": "invalid_bearer_token",
  "instance": "/path",
  "request_id": "5f7e0797-7a42-4807-afaa-3efb80c8423a"
}
```

#### 500 - Server Error

```
{
  "type": "https://example.com/error-type",
  "title": "Something went wrong",
  "status": 500,
  "detail": "please try again later",
  "code": "server_error",
  "instance": "/path",
  "request_id": "5f7e0797-7a42-4807-afaa-3efb80c8423a"
}
```

If you have any additional questions, you can contact our Customer Experience team via chat or at [support@anyroad.com](mailto:support@anyroad.com).
