Weekly Protocol Schedule API Documentation

This document provides complete and up-to-date information about the Weekly Protocol Schedule API, which manages and retrieves weekly protocol schedules for players.

Table of Contents

Overview

The Weekly Protocol Schedule API enables retrieval of weekly schedules for players, organized by week and intensity level. Schedules can be fetched for an entire organization (grouped by player) or for an individual player within a specific date range.

Authentication

All API endpoints require authentication. Include a valid api-key in the headers:

api-key: <your_api_key>

If the key is missing or invalid, the API responds with 401 Unauthorized.

REST API Endpoints

Weekly Protocol Schedules for all Players of an Organization

Returns a paginated list of players with their weekly protocol schedules for the given organization.

GET /api/weekly_protocol_schedules

List Weekly Protocol Schedules Query Parameters

Parameter Type Required Default Max Description
page integer No 1 Page number (must be a positive integer).
page_size integer No 50 50 Number of players per page (max: 50).
start_date string No 28 days before today Start date in ISO 8601 format (YYYY-MM-DD). If not provided, defaults to 4 weeks ago.
end_date string No Today End date in ISO 8601 format (YYYY-MM-DD). Must not be earlier than start_date.

List Weekly Protocol Schedules Date Range Constraints

The maximum allowed range is 84 days (12 weeks).

If start_date or end_date are invalid or exceed the range, a 400 Bad Request is returned.

List Weekly Protocol Schedules Response

{
  "organization_id": 9,
  "organization_name": "FlexProGrip",
  "page": 1,
  "page_size": 50,
  "start_date": "2025-09-10",
  "end_date": "2025-11-03",
  "total_schedules": 3,
  "players": [
    {
      "email": "player1@gmail.com",
      "start_date": "2025-11-03",
      "weekly_schedules": [
        {
          "monday": {
            "is_high_intensity": true,
            "protocol_statuses": [
              { "name": "Endurance % of 1RM Target (50%)", "status": "not_started" },
              { "name": "Endurance % of 1RM Target (80%)", "status": "completed" }
            ],
            "protocols": [
              "Endurance % of 1RM Target (50%)",
              "Endurance % of 1RM Target (80%)"
            ]
          },
          "tuesday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
          "wednesday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
          "thursday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
          "friday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
          "saturday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
          "sunday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] }
        }
      ]
    },
    {
      "email": "player2@gmail.com",
      "start_date": "2025-10-13",
      "weekly_schedules": [
        {
          "monday": { "is_high_intensity": true, "protocol_statuses": [], "protocols": [] },
          "tuesday": { "is_high_intensity": true, "protocol_statuses": [], "protocols": [] },
          "wednesday": {
            "is_high_intensity": false,
            "protocol_statuses": [{ "name": "Endurance % of 1RM Target (80%)", "status": "not_started" }],
            "protocols": ["Endurance % of 1RM Target (80%)"]
          },
          "thursday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
          "friday": { "is_high_intensity": true, "protocol_statuses": [], "protocols": [] },
          "saturday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
          "sunday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] }
        }
      ]
    }
  ]
}

Weekly Protocol Schedules for a Single Player

Retrieves a single player’s weekly protocol schedules for a specific date range.

GET /api/weekly_protocol_schedules/:player_id

Single Player’s weekly Schedule Path Parameters

Parameter Type Required Description
player_id string Yes Either the numeric player ID or the email address of the player. The system automatically detects the type.

Single Player’s weekly Schedule Query Parameters

Parameter Type Required Default Description
start_date string No January 1st of the current year Start date in ISO 8601 format (YYYY-MM-DD).
end_date string No December 31st of the current year End date in ISO 8601 format (YYYY-MM-DD).

⚠️ Unlike the list endpoint, this endpoint allows a full calendar year range by default.

Single Player’s weekly Schedule Response

{
  "organization_id": 9,
  "organization_name": "Flex Organization",
  "email": "player1@gmail.com",
  "total_schedules": 4,
  "start_date": "2025-01-01",
  "end_date": "2025-12-31",
  "weekly_schedules": [
    {
      "monday": { "is_high_intensity": true, "protocol_statuses": [], "protocols": [] },
      "tuesday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
      "wednesday": { "is_high_intensity": true, "protocol_statuses": [], "protocols": [] },
      "thursday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
      "friday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
      "saturday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] },
      "sunday": { "is_high_intensity": false, "protocol_statuses": [], "protocols": [] }
    }
  ]
}

Parameter Validation

Pagination

Parameter Rule Default Notes
page Must be a positive integer 1 Example: page=2
page_size Must be between 1 and 50 50 Larger values are rejected with 400 Bad Request.

Date Ranges

Endpoint Default Start Default End Max Range
/api/weekly_protocol_schedules 28 days before today Today 84 days (12 weeks)
/api/weekly_protocol_schedules/:player_id Jan 1 (current year) Dec 31 (current year) None

All dates must follow ISO 8601 format:

✅ Example: 2025-11-03

❌ Invalid: 11/03/2025, 03-11-25

Error Handling

HTTP Status Codes

  • 200 OK: Request successful
  • 400 Bad Request: Invalid parameters
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Resource not found
  • 500 Internal Server Error: Server error

Error Response Format

{
  "error": "Human-readable error message"
}

Examples

Example 1: List weekly schedules for organization

GET /api/weekly_protocol_schedules?page=1&page_size=20&start_date=2025-09-01&end_date=2025-11-01

Example 2: Get a single player’s schedule by ID

GET /api/weekly_protocol_schedules/123?start_date=2025-10-01&end_date=2025-10-31

Example 3: Get a player’s schedule by email

GET /api/weekly_protocol_schedules/player1@gmail.com?start_date=2025-09-01&end_date=2025-09-30