Get Collection by Slug
This endpoint retrieves detailed information about a specific collection by its slug and platform ID.
Endpoint
GET /api/collection-by-slug/:slug/:PlatformId
Authentication
No authentication required.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
slug | String | URL-friendly identifier of the collection |
PlatformId | Integer | ID of the platform the collection belongs to |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
limit | Integer | Optional. Maximum number of content items to return |
Response
Success Response
- Status Code: 200 OK
- Content: Detailed collection object with its associated content items
{
"id": 110,
"name": "Workshop Sessions",
"description": "<p>All workshop sessions from our recent event.</p>",
"slug": "workshop-sessions",
"collectionBGImage": "background-image.png",
"position": 1,
"expireDate": null,
"publishedDate": null,
"collectionType": "default",
"sortPreference": "most recent first",
"createdAt": "2022-01-15T19:24:52.000Z",
"updatedAt": "2022-03-03T06:42:31.000Z",
"PlatformId": 36,
"UserId": 123,
"Contents": [
{
"id": 456,
"title": "Introduction to Tribe Social",
"slug": "introduction-to-tribe-social",
"visibility": "public",
"type": "video",
"contentURI": "https://example.com/video.mp4",
"featuredImage": "thumbnail.jpg",
"publishedDate": "2022-01-20T00:00:00.000Z",
"expireDate": null,
"User": {
"id": 789,
"name": "Jane Smith",
"email": "[email protected]",
"role": "admin"
}
}
// Additional content items...
],
"contentTotal": 25
}
Error Response
- Status Code: 404 Not Found
- Content: Error message if the collection doesn't exist
{
"message": "Collection not found"
}
- Status Code: 500 Internal Server Error
- Content: Error message for server errors
Notes
- This endpoint filters content to exclude:
- Hidden content
- Expired content (where the current date is after the expireDate)
- Unpublished content (where the current date is before the publishedDate)
- The collection's content is returned in the order specified by the collection's
sortPreference. - If the
limitparameter is provided, only that number of content items will be returned, and the total count will be included in thecontentTotalfield. - This endpoint is commonly used for public-facing collection pages.
Example
# Get a collection with limited content items
curl -X GET "https://api.tribesocial.io/api/collection-by-slug/workshop-sessions/36?limit=10"
# Get a collection with all content items
curl -X GET "https://api.tribesocial.io/api/collection-by-slug/workshop-sessions/36"