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
| Field | Type | Required | Description |
|---|---|---|---|
groupId | Integer | Yes | ID of the group whose course order is being updated |
courseIds | Array of Integer | Yes | Course 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
groupIdorcourseIds. - 404 Not Found — The supplied
groupIddoes not exist. - 403 Forbidden — User does not have admin or creator privileges.
- 500 Internal Server Error — Unexpected server error.
Notes
- This endpoint updates the
positionfield on theGroupCoursejoin row for each course. The first course in the array getsposition: 0, the second getsposition: 1, and so on. - Only the
GroupCourserows that match the suppliedgroupIdand a course incourseIdsare touched. Courses must already be attached to the group (use Update Course withgroupIdsto 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]
}'