Content APIs

Actions, News, and Events APIs

Content APIs

Endpoints for managing Actions, News Articles, and Events.

Base URL: https://ycwadelaide.adenmgb.com

Authentication: All endpoints require Authorization: Bearer <token> header.

Common Patterns

All content APIs follow similar patterns:

  • GET /api/staff/{type} - List all items (published and draft)
  • GET /api/staff/{type}/:id - Get single item with full details
  • POST /api/staff/{type} - Create new item (saved as draft)
  • PUT /api/staff/{type}/:id - Update existing item
  • DELETE /api/staff/{type}/:id - Delete item
  • POST /api/staff/{type}/bulk - Bulk operations

Approval Workflow

All content goes through approval workflow:

  1. Create → Content saved as draft
  2. Request Approval → Status changes to pending
  3. Approve → Status changes to approved, content published
  4. Reject → Status changes to rejected, returns to draft

See Approval API for details.

Actions API

GET /api/staff/actions

Retrieve all actions (both published and draft).

Response:

[
  {
    "id": 1,
    "title": "SOL Music Events",
    "slug": "sol-music-events",
    "description": "Join us for music events",
    "icon": "MusicalNoteIcon",
    "gradientClass": "from-purple-500 to-pink-500",
    "accentClass": "text-purple-600",
    "link": "https://example.com",
    "coverImageUrl": "/api/images/cover.jpg",
    "published": true,
    "scheduledPublishAt": null,
    "approvalStatus": "approved"
  }
]

Notes:

  • Results ordered by displayOrder ASC, then id ASC
  • Draft actions have slug: null and published: false
  • icon must be valid Heroicon component name
  • gradientClass and accentClass are Tailwind CSS classes

POST /api/staff/actions

Create a new action.

Request Body:

{
  "title": "New Action Title",
  "description": "Short description",
  "content": "<p>Full HTML content (optional)</p>",
  "icon": "HandRaisedIcon",
  "gradientClass": "from-green-500 to-blue-500",
  "accentClass": "text-green-600",
  "link": "https://example.com/action",
  "coverImageUrl": "/api/images/action-cover.jpg",
  "published": false,
  "displayOrder": 0
}

Important: All new content is created as draft. Publishing requires approval workflow.

PUT /api/staff/actions/:id

Update an existing action.

Request Body: (Same as POST, all fields optional)

Note: Content can only be published if approvalStatus is "approved".

DELETE /api/staff/actions/:id

Delete an action. This action cannot be undone.

POST /api/staff/actions/bulk

Bulk operations on multiple actions.

Request Body:

{
  "operation": "publish",  // "publish", "unpublish", or "delete"
  "ids": [1, 2, 3]
}

News API

GET /api/staff/news

Retrieve all news articles (both published and draft).

Response:

[
  {
    "id": 1,
    "title": "YCW Adelaide News Update",
    "slug": "ycw-adelaide-news-update",
    "description": "Latest news from YCW Adelaide",
    "category": "Events",
    "imageUrl": "/api/images/news-cover.jpg",
    "published": true,
    "publishedAt": "2024-12-01T10:00:00.000Z",
    "approvalStatus": "approved"
  }
]

Notes:

  • Results ordered by publishedAt DESC, then createdAt DESC
  • category is optional string value
  • Content and tags not included in list - use detail endpoint

POST /api/staff/news

Create a new news article.

Request Body:

{
  "title": "New News Article",
  "description": "Article description/excerpt",
  "content": "<p>Full article HTML content</p>",
  "category": "Events",
  "imageUrl": "/api/images/article-cover.jpg",
  "published": false,
  "publishedAt": null,
  "tagIds": [1, 2, 3]
}

Important: All new content is created as draft. Publishing requires approval workflow.

PUT /api/staff/news/:id

Update an existing news article.

Request Body: (Same as POST, all fields optional)

Note: tagIds replaces all existing tags. Send empty array [] to remove all tags.

DELETE /api/staff/news/:id

Delete a news article. This action cannot be undone.

POST /api/staff/news/bulk

Bulk operations on multiple news articles.

Request Body:

{
  "operation": "publish",
  "ids": [1, 2, 3]
}

Events API

GET /api/staff/events

Retrieve all events (both published and draft).

Response:

[
  {
    "id": 1,
    "title": "YCW Adelaide Annual Meeting",
    "slug": "ycw-adelaide-annual-meeting",
    "description": "Join us for our annual meeting",
    "startDate": "2024-12-20T18:00:00.000Z",
    "endDate": "2024-12-20T20:00:00.000Z",
    "location": "YCW Adelaide Office",
    "imageUrl": "/api/images/event-cover.jpg",
    "link": "https://example.com/register",
    "published": true,
    "approvalStatus": "approved"
  }
]

Notes:

  • Results ordered by startDate ASC (upcoming events first)
  • endDate is optional (single-day events)
  • Dates in ISO 8601 format (UTC recommended)

POST /api/staff/events

Create a new event.

Request Body:

{
  "title": "New Event",
  "description": "Event description",
  "content": "<p>Full event details HTML</p>",
  "startDate": "2024-12-25T18:00:00.000Z",
  "endDate": "2024-12-25T21:00:00.000Z",
  "location": "Event Venue",
  "imageUrl": "/api/images/event.jpg",
  "link": "https://example.com/register",
  "published": false
}

Important: startDate is required. endDate is optional.

PUT /api/staff/events/:id

Update an existing event.

Request Body: (Same as POST, all fields optional)

DELETE /api/staff/events/:id

Delete an event. This action cannot be undone.

POST /api/staff/events/bulk

Bulk operations on multiple events.

Request Body:

{
  "operation": "publish",
  "ids": [1, 2, 3]
}

Tags API

GET /api/staff/tags

Retrieve all tags.

Response:

[
  {
    "id": 1,
    "name": "Events",
    "slug": "events"
  }
]

Notes:

  • Results ordered by name ASC (alphabetical)
  • Tags have both name (display) and slug (URL-friendly)

POST /api/staff/tags

Create a new tag.

Request Body:

{
  "name": "New Tag"
}

Response:

{
  "id": 5,
  "name": "New Tag",
  "slug": "new-tag"
}

PUT /api/staff/tags/:id

Update an existing tag.

Request Body:

{
  "name": "Updated Tag Name"
}

DELETE /api/staff/tags/:id

Delete a tag. This removes the tag from all associated content.