General Content API
Endpoints for managing educational content and resources.
Content Tags
List Content Tags
Get a list of content tags for categorization.
Endpoint: GET /v1/content/tags
Authentication: Required
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number for pagination |
page_size | integer | No | Number of items per page |
category | string | No | Filter by tag category |
Example Request
GET /v1/content/tags?category=mental_health HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_hereContent Collections
List Content Collections
Get a list of content collections.
Endpoint: GET /v1/content/collections
Authentication: Required
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number for pagination |
page_size | integer | No | Number of items per page |
tag_id | integer | No | Filter by tag ID |
age_group | string | No | Filter by target age group |
Example Request
GET /v1/content/collections?age_group=teen HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_hereContent Pieces
List Content Pieces
Get a list of individual content pieces.
Endpoint: GET /v1/content/pieces
Authentication: Required
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number for pagination |
page_size | integer | No | Number of items per page |
collection_id | integer | No | Filter by collection ID |
tag_id | integer | No | Filter by tag ID |
content_type | string | No | Filter by content type |
Example Request
GET /v1/content/pieces?content_type=video&tag_id=123 HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_hereGet Content Piece Details
Endpoint: GET /v1/content/pieces/{id}
Authentication: Required
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Content piece ID |
Example Request
GET /v1/content/pieces/456 HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_hereUser Content Pieces
List User Content Pieces
Get content pieces assigned to or accessed by a user.
Endpoint: GET /v1/content/user_pieces
Authentication: Required
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number for pagination |
page_size | integer | No | Number of items per page |
status | string | No | Filter by completion status |
content_type | string | No | Filter by content type |
Create User Content Piece
Assign a content piece to a user or mark it as accessed.
Endpoint: POST /v1/content/user_pieces
Authentication: Required
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_piece | object | Yes | User content piece data |
user_piece.content_piece_id | integer | Yes | Content piece ID |
user_piece.assigned_by | integer | No | ID of user who assigned it |
user_piece.due_date | string | No | Due date (YYYY-MM-DD) |
user_piece.notes | string | No | Assignment notes |
Example Request
POST /v1/content/user_pieces HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_here
{
"user_piece": {
"content_piece_id": 456,
"assigned_by": 789,
"due_date": "2023-11-01",
"notes": "Please review before next session"
}
}Update User Content Piece
Endpoint: PUT /v1/content/user_pieces/{id}
Authentication: Required
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | User content piece ID |
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_piece | object | Yes | User content piece data |
user_piece.status | string | No | Completion status |
user_piece.completed_at | string | No | Completion timestamp |
user_piece.rating | integer | No | User rating (1-5) |
user_piece.feedback | string | No | User feedback |
User Content Collections
List User Content Collections
Get content collections assigned to or accessed by a user.
Endpoint: GET /v1/content/user_collections
Authentication: Required
Create User Content Collection
Endpoint: POST /v1/content/user_collections
Authentication: Required
Update User Content Collection
Endpoint: PUT /v1/content/user_collections/{id}
Authentication: Required
Content Recommendations
Get Content Piece Recommendations
Get personalized content recommendations.
Endpoint: GET /v1/recommendations/content_pieces
Authentication: Required
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
patient_id | integer | No | Patient ID for personalization |
limit | integer | No | Number of recommendations |
content_type | string | No | Filter by content type |
Example Request
GET /v1/recommendations/content_pieces?patient_id=1049&limit=5 HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_hereResponse Format
Content Tag Response
{
"id": 123,
"name": "anxiety",
"display_name": "Anxiety",
"category": "mental_health",
"description": "Content related to anxiety management",
"color": "#FF6B6B",
"created_at": "2023-10-20T10:00:00.000Z"
}Content Collection Response
{
"id": 456,
"title": "Coping with Anxiety",
"description": "A collection of resources for managing anxiety",
"age_group": "teen",
"estimated_duration": 45,
"piece_count": 8,
"tags": [
{
"id": 123,
"name": "anxiety"
}
],
"created_at": "2023-10-20T10:00:00.000Z"
}Content Piece Response
{
"id": 789,
"title": "Deep Breathing Techniques",
"description": "Learn effective deep breathing exercises",
"content_type": "video",
"duration_minutes": 10,
"url": "https://content.example.com/videos/deep-breathing.mp4",
"thumbnail_url": "https://content.example.com/thumbnails/deep-breathing.jpg",
"age_group": "all",
"difficulty_level": "beginner",
"tags": [
{
"id": 123,
"name": "anxiety"
}
],
"created_at": "2023-10-20T10:00:00.000Z"
}User Content Piece Response
{
"id": 321,
"content_piece_id": 789,
"user_id": 1049,
"status": "completed",
"assigned_by": 456,
"assigned_at": "2023-10-27T10:00:00.000Z",
"due_date": "2023-11-01",
"completed_at": "2023-10-28T14:30:00.000Z",
"rating": 5,
"feedback": "Very helpful techniques",
"notes": "Please review before next session",
"content_piece": {
"id": 789,
"title": "Deep Breathing Techniques",
"content_type": "video"
}
}Content Types
video- Video contentarticle- Written articlesaudio- Audio content/podcastsinteractive- Interactive exercisesworksheet- Downloadable worksheetsquiz- Educational quizzes
Age Groups
child- Ages 5-12teen- Ages 13-17adult- Ages 18+all- All age groups
Completion Status Values
assigned- Content assigned but not startedstarted- Content has been startedin_progress- Content is being consumedcompleted- Content has been completedskipped- Content was skipped
Difficulty Levels
beginner- Beginner levelintermediate- Intermediate leveladvanced- Advanced level
Error Responses
422 Unprocessable Entity
{
"errors": {
"content_piece_id": ["can't be blank"],
"rating": ["must be between 1 and 5"]
}
}404 Not Found
{
"errors": "Content piece not found"
}Notes
- Content is organized hierarchically: tags → collections → pieces
- User assignments track progress and engagement
- Recommendations are personalized based on user history and preferences
- Content can be filtered by age group, difficulty, and other criteria
- User feedback helps improve content recommendations
- Content access may be restricted based on user permissions