POST /modules/reorder
POST /modules/reorder
POST /api/modules/reorder - Reorder modules within a course Check authentication with Clerk Get user's profile Parse request body Validate required fields Verify course exists and user has access Check permissions Update order_index for each module sequentially to avoid unique constraint violations Strategy: Use negative order_index temporarily (which won't conflict with positive values) Step 1: Set all modules to unique negative temporary values Step 2: Update each module to its final positive order_index Fetch updated modules
Endpoint
POST /modules/reorder
Authentication
This endpoint requires authentication. Include your authentication token in the request headers.
Error Responses
| Status Code | Error Code | Description |
|---|---|---|
| 401 | HTTP_401 | Unauthorized |
| 404 | HTTP_404 | Not Found |
| 400 | HTTP_400 | Bad Request |
| 400 | HTTP_400 | Bad Request |
| 404 | HTTP_404 | Not Found |
| 403 | HTTP_403 | Forbidden |
| 500 | HTTP_500 | Internal Server Error |
Example Request
curl -X POST "https://api.allurelms.com/modules/reorder" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'