# List Calendar Resources

GET https://services.leadconnectorhq.com/calendars/resources/{resourceType}

List calendar resources by resource type and location ID (Services V1)

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `calendars/resources.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `resourceType` | string | Yes | Calendar Resource Type |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location ID |
| `limit` | number | Yes | Maximum number of results |
| `skip` | number | Yes | Number of results to skip |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/calendars/resources/{resourceType}": {
      "get": {
        "summary": "List Calendar Resources",
        "operationId": "listCalendarResources",
        "description": "List calendar resources by resource type and location ID (Services V1)",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "resourceType",
            "required": true,
            "in": "path",
            "description": "Calendar Resource Type",
            "schema": {
              "enum": [
                "equipments",
                "rooms"
              ],
              "type": "string",
              "example": "equipments"
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string",
              "example": "ocQHyuzHvysMo5N5VsXc"
            },
            "description": "Location ID"
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number",
              "example": 20
            },
            "description": "Maximum number of results"
          },
          {
            "name": "skip",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number",
              "example": 0
            },
            "description": "Number of results to skip"
          }
        ],
        "responses": {
          "200": {
            "description": "Calendar resources listed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCalendarResourcesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": [
              "calendars/resources.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "ListCalendarResourcesResponse": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "locationId": {
              "type": "string",
              "description": "Location ID of the resource",
              "example": "ocQHyuzHvysMo5N5VsXc"
            },
            "name": {
              "type": "string",
              "description": "Name of the resource",
              "example": "yoga room"
            },
            "resourceType": {
              "type": "string",
              "enum": [
                "equipments",
                "rooms"
              ],
              "description": "Type of the calendar resource",
              "example": "rooms"
            },
            "isActive": {
              "type": "boolean",
              "description": "Whether the resource is active",
              "example": true
            },
            "description": {
              "type": "string",
              "description": "Description of the resource",
              "example": "Spacious yoga studio"
            },
            "quantity": {
              "type": "number",
              "description": "Quantity of the resource",
              "example": 3
            },
            "outOfService": {
              "type": "number",
              "description": "Indicates if the resource is out of service",
              "example": 0
            },
            "capacity": {
              "type": "number",
              "description": "Capacity of the resource",
              "example": 85
            },
            "calendarIds": {
              "description": "Calendar IDs",
              "example": [
                "Jsj0xnlDDjw0SuvX1J13",
                "oCM5feFC86FAAbcO7lJK"
              ],
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "locationId",
            "name",
            "resourceType",
            "isActive",
            "calendarIds"
          ],
          "title": "CalendarResourceByIdResponseDTO"
        }
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/calendars/resources/<resourceType>?locationId=<LOCATIONID>&limit=<LIMIT>&skip=<SKIP>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/calendars/resources/<resourceType>?locationId=<LOCATIONID>&limit=<LIMIT>&skip=<SKIP>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/calendars/resources/{resourceType}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

params = {
    "locationId": "<LOCATIONID>",
    "limit": "<LIMIT>",
    "skip": "<SKIP>"
}

response = requests.get(url, params=params, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/calendars/resources/<resourceType>?locationId=<LOCATIONID>&limit=<LIMIT>&skip=<SKIP>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/calendars/resources/<resourceType>?locationId=<LOCATIONID>&limit=<LIMIT>&skip=<SKIP>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  url := "https://services.leadconnectorhq.com/calendars/resources/<resourceType>?locationId=<LOCATIONID>&limit=<LIMIT>&skip=<SKIP>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/calendars/resources/<resourceType>?locationId=<LOCATIONID>&limit=<LIMIT>&skip=<SKIP>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/calendars/resources/<resourceType>?locationId=<LOCATIONID>&limit=<LIMIT>&skip=<SKIP>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
