Approval APIs
Request, approve, and reject content for publication
Approval APIs
Endpoints for requesting approval, approving, and rejecting content for publication.
Base URL: https://ycwadelaide.adenmgb.com
Authentication: All endpoints require Authorization: Bearer <token> header.
Overview
The approval system enforces a workflow where:
- Content creators create content as drafts
- Content creators request approval for publication
- Approvers review and approve or reject content
- Approved content is automatically published
- Rejected content returns to draft status with optional feedback
Supported Content Types:
actions- YCW Actionsevents- Eventsnews- News Articlesnewsletters- Newsletters
Approval Status Values:
draft- Initial state, not submitted for approvalpending- Approval requested, awaiting reviewapproved- Approved and ready to publishrejected- Rejected, needs changes
POST /api/staff/approval/request
Request approval for content to be published.
Headers:
Request Body:
Success Response (200 OK):
What Happens:
- Content
approval_statusis set topending approval_requested_attimestamp is setapproval_requested_byis set to requesting user ID- Notifications are sent to all approvers
- Audit log entry is created
Error Responses:
- 400 Bad Request - Missing required fields
- 401 Unauthorized - Not authenticated
- 404 Not Found - Content not found
- 500 Internal Server Error - Failed to request approval
POST /api/staff/approval/approve
Approve content for publication. This automatically publishes the content.
Headers:
Request Body:
Success Response (200 OK):
What Happens:
- Content
approval_statusis set toapproved approved_attimestamp is setapproved_byis set to approver user ID- Content
publishedstatus is set to1(published) - Notification is sent to the requester
- Audit log entry is created
Error Responses:
- 400 Bad Request - Missing required fields
- 401 Unauthorized - Not authenticated
- 403 Forbidden - User doesn't have permission to approve
- 404 Not Found - Content not found
- 500 Internal Server Error - Failed to approve
Notes:
- User must have approval permissions for the content type
- Content is automatically published when approved
- Only one approval is needed
POST /api/staff/approval/reject
Reject content and return it to draft status.
Headers:
Request Body:
Success Response (200 OK):
What Happens:
- Content
approval_statusis set torejected rejected_attimestamp is setrejected_byis set to rejector user IDrejection_reasonis stored (if provided)- Content
publishedstatus is set to0(unpublished) - Notification is sent to the requester with rejection reason
- Audit log entry is created
Error Responses:
- 400 Bad Request - Missing required fields
- 401 Unauthorized - Not authenticated
- 403 Forbidden - User doesn't have permission to reject
- 404 Not Found - Content not found
- 500 Internal Server Error - Failed to reject
Notes:
- Rejection reason is optional but recommended
- Content is automatically unpublished when rejected
GET /api/staff/approval-config
Get approval configuration (which roles can approve which content types).
Headers:
Success Response (200 OK):
Notes:
- Only users with admin permissions can view/modify approval config
- Used to determine who receives approval request notifications
POST /api/staff/approval-config
Create approval configuration (assign approval permissions to roles).
Headers:
Request Body:
Success Response (200 OK):
Notes:
- Requires admin permissions
- Users with the specified role will receive approval request notifications
DELETE /api/staff/approval-config/:id
Delete approval configuration.
Headers:
URL Parameters:
id- Configuration ID
Success Response (200 OK):
Notes:
- Requires admin permissions
- Removes approval permissions for a role/content type combination
Workflow Example
- Create Content (Draft)
- Request Approval
- Approver Reviews and Approves
Related APIs
- Notifications API - View approval notifications
- Content APIs - Manage content