Skip to main content

Reorder Courses

This endpoint updates the display order of multiple courses within a single group.

Endpoint​

POST /api/courses/reorder

Authentication​

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

Request Body​

FieldTypeRequiredDescription
groupIdIntegerYesID of the group whose course order is being updated
courseIdsArray of IntegerYesCourse IDs in the desired display order, lowest index first

Response​

Success Response​

  • Status Code: 200 OK
  • Content: Empty body

Error Responses​

  • 400 Bad Request — Missing groupId or courseIds.
  • 404 Not Found — The supplied groupId does not exist.
  • 403 Forbidden — User does not have admin or creator privileges.
  • 500 Internal Server Error — Unexpected server error.

Notes​

  • This endpoint updates the position field on the GroupCourse join row for each course. The first course in the array gets position: 0, the second gets position: 1, and so on.
  • Only the GroupCourse rows that match the supplied groupId and a course in courseIds are touched. Courses must already be attached to the group (use Update Course with groupIds to attach them first).
  • Reordering does not modify the courses themselves and does not change collection or content order — only the per-group sort position of the course.

Example​

curl -X POST "https://api.tribesocial.io/api/courses/reorder" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"groupId": 12,
"courseIds": [42, 17, 88]
}'