Skip to Content

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

ParameterTypeRequiredDescription
pageintegerNoPage number for pagination
page_sizeintegerNoNumber of items per page
categorystringNoFilter by tag category

Example Request

GET /v1/content/tags?category=mental_health HTTP/1.1 Content-Type: application/json X-User-Token: your_token_here

Content Collections

List Content Collections

Get a list of content collections.

Endpoint: GET /v1/content/collections
Authentication: Required

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoPage number for pagination
page_sizeintegerNoNumber of items per page
tag_idintegerNoFilter by tag ID
age_groupstringNoFilter 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_here

Content Pieces

List Content Pieces

Get a list of individual content pieces.

Endpoint: GET /v1/content/pieces
Authentication: Required

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoPage number for pagination
page_sizeintegerNoNumber of items per page
collection_idintegerNoFilter by collection ID
tag_idintegerNoFilter by tag ID
content_typestringNoFilter 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_here

Get Content Piece Details

Endpoint: GET /v1/content/pieces/{id}
Authentication: Required

Path Parameters

ParameterTypeRequiredDescription
idintegerYesContent piece ID

Example Request

GET /v1/content/pieces/456 HTTP/1.1 Content-Type: application/json X-User-Token: your_token_here

User 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

ParameterTypeRequiredDescription
pageintegerNoPage number for pagination
page_sizeintegerNoNumber of items per page
statusstringNoFilter by completion status
content_typestringNoFilter 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

ParameterTypeRequiredDescription
user_pieceobjectYesUser content piece data
user_piece.content_piece_idintegerYesContent piece ID
user_piece.assigned_byintegerNoID of user who assigned it
user_piece.due_datestringNoDue date (YYYY-MM-DD)
user_piece.notesstringNoAssignment 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

ParameterTypeRequiredDescription
idintegerYesUser content piece ID

Request Body Parameters

ParameterTypeRequiredDescription
user_pieceobjectYesUser content piece data
user_piece.statusstringNoCompletion status
user_piece.completed_atstringNoCompletion timestamp
user_piece.ratingintegerNoUser rating (1-5)
user_piece.feedbackstringNoUser 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

ParameterTypeRequiredDescription
patient_idintegerNoPatient ID for personalization
limitintegerNoNumber of recommendations
content_typestringNoFilter 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_here

Response 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 content
  • article - Written articles
  • audio - Audio content/podcasts
  • interactive - Interactive exercises
  • worksheet - Downloadable worksheets
  • quiz - Educational quizzes

Age Groups

  • child - Ages 5-12
  • teen - Ages 13-17
  • adult - Ages 18+
  • all - All age groups

Completion Status Values

  • assigned - Content assigned but not started
  • started - Content has been started
  • in_progress - Content is being consumed
  • completed - Content has been completed
  • skipped - Content was skipped

Difficulty Levels

  • beginner - Beginner level
  • intermediate - Intermediate level
  • advanced - 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