Skip to main content

Get Public Collections

This endpoint retrieves public collections for a specific platform, optimized for display on the platform's homepage.

Endpoint

GET /api/collection/public/:PlatformId

Authentication

Optional authentication. If authenticated, the response may include user-specific data such as whether the current user has liked content items.

Path Parameters

ParameterTypeDescription
PlatformIdIntegerID of the platform to retrieve public collections for

Query Parameters

ParameterTypeDescription
itemsPerPageIntegerNumber of items to return per page
currentPageIntegerPage number to retrieve
searchTermStringTerm to search for in collection names
filtersObjectJSON object with filter criteria
sortStringField and direction to sort by (e.g., "name:asc")

Response

Success Response

  • Status Code: 200 OK
  • Content: Paginated collection objects with their associated content and ad information
{
"items": [
{
"id": 509,
"name": "Events",
"slug": "Events",
"position": -99,
"sortPreference": "chronological",
"updatedAt": "2022-03-16T01:40:44.000Z",
"Contents": [
{
"id": 4473,
"title": "Upcoming Workshop - March 3, 2022",
"slug": "upcoming-workshop-march-3-2022",
"visibility": "public",
"duration": 3600,
"contentURI": "https://example.com/video.mp4",
"type": "video",
"featuredImage": "image.jpg",
"publishedDate": "2022-03-01T00:00:00.000Z",
"expireDate": null,
"User": {
"id": 123,
"name": "John Doe"
},
"ContentCollection": {
"position": 1
}
}
],
"Ads": [],
"contentTotal": 5
}
],
"currentPage": 1,
"itemsPerPage": 25,
"totalItems": 10,
"totalPages": 1,
"firstItem": 1,
"lastItem": 10
}

Error Response

  • Status Code: 500 Internal Server Error
  • Content: Error message
{
"error": "Something went wrong"
}

Notes

  • This endpoint is optimized for public display and only returns collections marked with showOnHomepage: true.
  • Content items are filtered 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 response includes only essential collection and content attributes to minimize payload size.
  • Content within each collection is ordered according to the collection's sortPreference.
  • Only the first 20 content items for each collection are returned, with the total count provided in contentTotal.

Example

curl -X GET "https://api.tribesocial.io/api/collection/public/36?itemsPerPage=10&currentPage=1"