# Fetch slot information for queue items

POST https://services.leadconnectorhq.com/social-media-posting/category/queues/{queueId}/slots

Returns paginated slot information (scheduledDateTime, isSkipped) for queue items. Pass sessionId to get slots for draft items, or omit for live items. Call this after mutations to refresh slot data.

## Authentication

Send `Authorization: Bearer <token>` using:

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

## Parameters

### Header Parameters

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

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `queueId` | string | Yes | Category queue ID |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/social-media-posting/category/queues/{queueId}/slots": {
      "post": {
        "summary": "Fetch slot information for queue items",
        "operationId": "fetchSlotInformationForQueueItems",
        "description": "Returns paginated slot information (scheduledDateTime, isSkipped) for queue items. Pass sessionId to get slots for draft items, or omit for live items. Call this after mutations to refresh slot data.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "queueId",
            "required": true,
            "in": "path",
            "description": "Category queue ID",
            "schema": {
              "example": "507f1f77bcf86cd799439011",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FetchSlotsDTO"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Slots fetched successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WrappedFetchSlotsResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "socialplanner/category.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": {
      "FetchSlotsDTO": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "description": "The location ID",
            "example": "abc123"
          },
          "sessionId": {
            "type": "string",
            "description": "Session ID for edit mode. If not provided, calculates slots for live items.",
            "example": "507f1f77bcf86cd799439011"
          },
          "skip": {
            "type": "number",
            "description": "Number of items to skip",
            "example": 0,
            "default": 0
          },
          "limit": {
            "type": "number",
            "description": "Number of items to return",
            "example": 20,
            "default": 20
          }
        },
        "required": [
          "locationId"
        ],
        "title": "FetchSlotsDTO"
      },
      "WrappedFetchSlotsResponseDTO": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Success or Failure",
            "example": true
          },
          "statusCode": {
            "type": "number",
            "description": "Status Code",
            "example": 200
          },
          "results": {
            "description": "Response payload",
            "example": {
              "message": "Slots fetched successfully",
              "slots": [
                {
                  "itemId": "60af88475f1b2c001f5d5f4b",
                  "scheduledDateTime": "2023-10-15T10:00:00.000Z",
                  "isSkipped": false,
                  "order": 18000
                }
              ],
              "total": 100,
              "skip": 0,
              "limit": 20,
              "timezone": "America/New_York"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "description": "Message",
                    "example": "Slots fetched successfully"
                  },
                  "slots": {
                    "description": "Slot information for items in the requested range",
                    "example": [
                      {
                        "itemId": "60af88475f1b2c001f5d5f4b",
                        "scheduledDateTime": "2023-10-15T10:00:00.000Z",
                        "isSkipped": false,
                        "order": 18000
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "itemId": {
                          "type": "string",
                          "example": "60af88475f1b2c001f5d5f4b",
                          "description": "The ID of the queue item"
                        },
                        "scheduledDateTime": {
                          "format": "date-time",
                          "type": "string",
                          "example": "2023-10-15T10:00:00.000Z",
                          "description": "The updated scheduled date/time for this item",
                          "nullable": true
                        },
                        "isSkipped": {
                          "type": "boolean",
                          "example": false,
                          "description": "Indicates if this time slot is skipped"
                        },
                        "order": {
                          "type": "number",
                          "example": 18000,
                          "description": "The order value of the queue item. Use this to sort items for consistent display ordering."
                        }
                      },
                      "title": "UpdatedSlotInfoDTO"
                    }
                  },
                  "total": {
                    "type": "number",
                    "example": 100,
                    "description": "Total number of items in the queue"
                  },
                  "skip": {
                    "type": "number",
                    "example": 0,
                    "description": "Number of items skipped"
                  },
                  "limit": {
                    "type": "number",
                    "example": 20,
                    "description": "Number of items returned"
                  },
                  "timezone": {
                    "type": "string",
                    "example": "America/New_York",
                    "description": "Timezone used for slot calculations"
                  }
                },
                "title": "FetchSlotsResponseDTO"
              }
            ]
          },
          "traceId": {
            "type": "string",
            "description": "Trace ID for debugging",
            "example": "TRACE-abc123-def456"
          }
        },
        "required": [
          "success",
          "statusCode",
          "results"
        ],
        "title": "WrappedFetchSlotsResponseDTO"
      },
      "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"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/social-media-posting/category/queues/<queueId>/slots' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "locationId": "abc123",
  "sessionId": "507f1f77bcf86cd799439011",
  "skip": 0,
  "limit": 20
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "locationId": "abc123",
      "sessionId": "507f1f77bcf86cd799439011",
      "skip": 0,
      "limit": 20
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/social-media-posting/category/queues/<queueId>/slots', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/social-media-posting/category/queues/{queueId}/slots"

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

payload = {
    "locationId": "abc123",
    "sessionId": "507f1f77bcf86cd799439011",
    "skip": 0,
    "limit": 20
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

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

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/social-media-posting/category/queues/<queueId>/slots',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "locationId": "abc123",
  "sessionId": "507f1f77bcf86cd799439011",
  "skip": 0,
  "limit": 20
}',
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/social-media-posting/category/queues/<queueId>/slots")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"locationId\":\"abc123\",\"sessionId\":\"507f1f77bcf86cd799439011\",\"skip\":0,\"limit\":20}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/social-media-posting/category/queues/<queueId>/slots"
  payload := strings.NewReader(`{
  "locationId": "abc123",
  "sessionId": "507f1f77bcf86cd799439011",
  "skip": 0,
  "limit": 20
}`)
  req, _ := http.NewRequest("POST", url, payload)
  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/social-media-posting/category/queues/<queueId>/slots")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "locationId": "abc123",
  "sessionId": "507f1f77bcf86cd799439011",
  "skip": 0,
  "limit": 20
}'

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

**PowerShell**

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

$body = '{
  "locationId": "abc123",
  "sessionId": "507f1f77bcf86cd799439011",
  "skip": 0,
  "limit": 20
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/social-media-posting/category/queues/<queueId>/slots' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
