Skip to main content

Get Collections for Dashboard

This endpoint retrieves collections for use in the admin dashboard, with pagination, filtering, and search capabilities.

Endpoint

GET /api/admin/collections

Alternative endpoint (legacy, will be deprecated):

GET /api/collection

Authentication

Authentication is required. User must have admin or creator role.

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 platform and group information
{
"items": [
{
"id": 509,
"name": "Events",
"description": "[{\"id\":\"zyrh9AM2pK\",\"type\":\"paragraph\",\"data\":{\"text\":\"All upcoming events available to our Community.\"}}]",
"slug": "Events",
"collectionBGImage": null,
"position": -99,
"expireDate": null,
"publishedDate": null,
"collectionType": "default",
"sortPreference": "chronological",
"createdAt": "2022-03-09T19:54:14.000Z",
"updatedAt": "2022-03-16T01:40:44.000Z",
"PlatformId": 36,
"UserId": 6604,
"Platform": {
"id": 36,
"name": "KingdomMessenger TV",
"slug": "kmw",
"description": "Welcome to the membership site."
// Additional platform properties...
},
"Groups": []
}
// Additional collections...
],
"currentPage": 1,
"itemsPerPage": 25,
"totalItems": 10,
"totalPages": 1,
"firstItem": 1,
"lastItem": 10,
"sort": "position:asc",
"filters": null
}

Error Response

  • Status Code: 403 Forbidden
  • Content: Error message if the user doesn't have permission
{
"error": "Access denied"
}
  • Status Code: 500 Internal Server Error
  • Content: Error message for server errors
{
"error": "Something went wrong"
}

Notes

  • This endpoint is intended for administrative use in the dashboard.
  • For creator users, only collections created by that user are returned.
  • For admin users, all collections for the platform are returned.
  • The response includes the platform information (excluding sensitive credentials) and associated groups.
  • The default sort order is by position in ascending order.
  • This endpoint does not return the content items within collections to keep the response size manageable.

Example

# Get the first page of collections with 10 items per page
curl -X GET "https://api.tribesocial.io/api/admin/collections?itemsPerPage=10&currentPage=1" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"

# Search for collections with "workshop" in the name
curl -X GET "https://api.tribesocial.io/api/admin/collections?searchTerm=workshop" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"

# Sort collections by name in descending order
curl -X GET "https://api.tribesocial.io/api/admin/collections?sort=name:desc" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"