GET /lessons
Request URL
UAT environment:
https://us-central1-gofa-sdk.cloudfunctions.net/expressApp/lessons
PRD environment:
https://us-central1-gofa-sdk-prd.cloudfunctions.net/expressApp/lessons
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
clientId | String | Yes | The identifier for the GOFA client. |
clientSecret | String | Yes | The secret key for authenticating the GOFA client's identity. |
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | String | Yes | Bearer token retrieved from Firebase Auth. Example: Bearer <ID Token> |
Authentication
GOFA clients must use a Bearer token for authorization. The ID Token can be retrieved by signing in through Firebase Auth, either via the Web SDK or the Firebase Auth REST API.
Sample Request
GET https://us-central1-gofa-sdk.cloudfunctions.net/expressApp/lessons?clientId=abc&clientSecret=abcSecretKey123&clientUserId=isaacchan
Headers:
Authorization: Bearer <ID Token>
Response
Sample Response (200 OK):
{
"oCcBJHjwsoSpDFjtmVkV": {
"groupByTypes": [
"HIIT"
],
"modifyDatetime": {
"_nanoseconds": 29000000,
"_seconds": 1647601811
},
"description": {
"en": "Ready for a full-body burner? Start your day right with this quick and easy HIIT workout, guaranteed to wake up the body.",
"zh": "準備好全身燃燒器了嗎?通過這種快速簡單的 HIIT 鍛煉開始新的一天,保證喚醒身體。"
},
"isIndividual": true,
"videoURLs": [
"https://videodelivery.net/921e77634bda96607579a652ae4a1a1e/manifest/video.m3u8"
],
"title": {
"en": "Body Burnout",
"zh": "身體倦怠"
},
"groupByGoals": [
"WEIGHT_LOSS",
"CARDIO_FITNESS",
"GET_LEAN_AND_TONED"
],
"duration": 11,
"groupByEquipments": [
"NO_EQUIPMENT"
],
"groupByIntensity": "BREAK_A_SWEAT",
"modifiedBy": "SYSTEM",
"id": "oCcBJHjwsoSpDFjtmVkV",
"uniqueID": "Cardio-HIIT #1",
"algorithm": "VIDEO_COUNT",
"groupByStyles": [
"CARDIO",
"TONE",
"LEAN"
],
"batch": 2,
"sync": true,
"thumbImageUrl": "https://firebasestorage.googleapis.com/v0/b/gofa-f0630.appspot.com/o/workouts%2FoCcBJHjwsoSpDFjtmVkV%2Fthumb_image?alt=media&token=c7574fa9-a48f-4e3c-aa50-295674b17ef6",
"createDatetime": {
"_nanoseconds": 577000000,
"_seconds": 1634012752
},
"intensity": "7.5",
"groupByMuscles": [],
"createdBy": "SYSTEM",
"groupByTrainers": [
"DANIELLE"
],
"MET": 0,
"status": "active",
"imageUrl": "https://firebasestorage.googleapis.com/v0/b/goalfit-cloud-staging.appspot.com/o/workouts%2FoCcBJHjwsoSpDFjtmVkV%2Fimage?alt=media&token=69687b95-3d49-4c87-ae2b-a40c158516cf&_gl=1*xzx95c*_ga*NTA0OTU3Mzc3LjE2ODc5MzM2NDk.*_ga_CW55HF8NVT*MTY5ODgzMDMxMS45NS4xLjE2OTg4MzExMDYuNTIuMC4w",
"sessions": [
{
"aiScripts": [],
"rule": null,
"index": 0,
"videoURLs": [],
"audioURLs": [],
"timeout": 2.1666666666666665
},
{
"aiScripts": [],
"rule": {
"poseName": "PUSHUP_SHOULDER_TAP",
"count": {
"display": true,
"value": 6,
"required": true
},
"selectOption": "time",
"time": {
"display": true,
"value": 0.48333333333333334,
"required": true
},
"poseId": "PUSH_UP",
"title": {
"zh_Hans": "伏地挺身和肩膊拍手",
"en": "Push-up and Shoulder Tap",
"zh_Hant": "伏地挺身和肩膊拍手"
}
},
"index": 1,
"control": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 1
},
{
"aiScripts": [],
"rule": null,
"index": 2,
"videoURLs": [],
"audioURLs": [],
"timeout": 0.5166666666666667
},
{
"aiScripts": [],
"rule": {
"poseName": "PULSE_SQUAT",
"count": {
"display": true,
"value": 8,
"required": true
},
"selectOption": "time",
"time": {
"display": true,
"value": 0.5166666666666667,
"required": true
},
"poseId": "PULSE_SQUAT",
"title": {
"zh_Hans": "脉衝蹲",
"en": "Pulse Squat",
"zh_Hant": "脈衝蹲"
}
},
"index": 3,
"control": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 1
},
{
"aiScripts": [],
"index": 4,
"rule": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 0.7333333333333333
},
{
"aiScripts": [],
"index": 5,
"rule": {
"poseName": "SIDE_PLANK_TWIST",
"selectOption": "time",
"count": {
"display": true,
"value": 7,
"required": true
},
"time": {
"display": true,
"value": 0.5833333333333334,
"required": true
},
"poseId": "SIDE_PLANK_TWIST",
"title": {
"zh_Hans": "侧卧撑和扭转",
"en": "Side Plank & Twist",
"zh_Hant": "側臥撐和扭轉"
}
},
"control": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 1
},
{
"aiScripts": [],
"index": 6,
"rule": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 0.3333333333333333
},
{
"aiScripts": [],
"index": 7,
"rule": {
"poseName": "PUSHUP_SHOULDER_TAP",
"selectOption": "time",
"count": {
"display": true,
"value": 6,
"required": true
},
"time": {
"display": true,
"value": 0.5,
"required": true
},
"poseId": "PUSH_UP",
"title": {
"zh_Hans": "伏地挺身和肩膊拍手",
"en": "Push-up and Shoulder Tap",
"zh_Hant": "伏地挺身和肩膊拍手"
}
},
"control": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 1
},
{
"aiScripts": [],
"rule": null,
"index": 8,
"videoURLs": [],
"audioURLs": [],
"timeout": 0.36666666666666664
},
{
"aiScripts": [],
"index": 9,
"rule": {
"poseName": "PULSE_SQUAT",
"count": {
"display": true,
"value": 8,
"required": true
},
"selectOption": "time",
"time": {
"display": true,
"value": 0.5333333333333333,
"required": true
},
"poseId": "PULSE_SQUAT",
"title": {
"zh_Hans": "脉衝蹲",
"en": "Pulse Squat",
"zh_Hant": "脈衝蹲"
}
},
"control": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 1
},
{
"aiScripts": [],
"rule": null,
"index": 10,
"videoURLs": [],
"audioURLs": [],
"timeout": 0.5166666666666667
},
{
"aiScripts": [],
"rule": {
"poseName": "SIDE_PLANK_TWIST",
"count": {
"display": true,
"value": 7,
"required": true
},
"selectOption": "time",
"time": {
"display": true,
"value": 0.5,
"required": true
},
"poseId": "SIDE_PLANK_TWIST",
"title": {
"zh_Hans": "侧卧撑和扭转",
"en": "Side Plank & Twist",
"zh_Hant": "側臥撐和扭轉"
}
},
"index": 11,
"control": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 1
},
{
"aiScripts": [],
"index": 12,
"rule": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 0.4
},
{
"aiScripts": [],
"index": 13,
"rule": {
"poseName": "PUSHUP_SHOULDER_TAP",
"count": {
"display": true,
"value": 6,
"required": true
},
"selectOption": "time",
"time": {
"display": true,
"value": 0.43333333333333335,
"required": true
},
"poseId": "PUSH_UP",
"title": {
"zh_Hans": "伏地挺身和肩膊拍手",
"en": "Push-up and Shoulder Tap",
"zh_Hant": "伏地挺身和肩膊拍手"
}
},
"control": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 1
},
{
"aiScripts": [],
"index": 14,
"rule": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 0.25
},
{
"aiScripts": [],
"index": 15,
"rule": {
"poseName": "PULSE_SQUAT",
"selectOption": "time",
"count": {
"display": true,
"value": 6,
"required": true
},
"time": {
"display": true,
"value": 0.55,
"required": true
},
"poseId": "PULSE_SQUAT",
"title": {
"zh_Hans": "脉衝蹲",
"en": "Pulse Squat",
"zh_Hant": "脈衝蹲"
}
},
"control": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 1
},
{
"aiScripts": [],
"index": 16,
"rule": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 0.3333333333333333
},
{
"aiScripts": [],
"rule": {
"poseName": "SIDE_PLANK_TWIST",
"selectOption": "time",
"count": {
"display": true,
"value": 7,
"required": true
},
"time": {
"display": true,
"value": 0.45,
"required": true
},
"poseId": "SIDE_PLANK_TWIST",
"title": {
"zh_Hans": "侧卧撑和扭转",
"en": "Side Plank & Twist",
"zh_Hant": "側臥撐和扭轉"
}
},
"index": 17,
"control": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 1
},
{
"aiScripts": [],
"index": 18,
"rule": null,
"videoURLs": [],
"audioURLs": [],
"timeout": 0.31666666666666665
}
],
"subtitleUrl": {
"en": "https://storage.googleapis.com/gofa-sdk.appspot.com/lessons%2Fsubtitles%2Fen%2FCardio-HIIT%20%231.vtt",
"zh": "https://storage.googleapis.com/gofa-sdk.appspot.com/lessons%2Fsubtitles%2Fzh%2FCardio-HIIT%20%231.vtt"
},
"videoId": "921e77634bda96607579a652ae4a1a1e",
"clientId": "gofa"
},
...
}
Error Responses
| Status Code | Error Message | Description |
|---|---|---|
403 | Forbidden | Provided credentials are incorrect or cannot be found. |
404 | Not Found | The data cannot be found. |
Sample Error Response (403 Forbidden):
Unauthorized
Sample Error Response (404 Not Found):
Lessons not found
Rate Limiting
Rate limiting is essential to ensure fair usage and protect the system from abuse. The proposed rate limiting policy is as follows:
- 60 requests per minute per client: Standard rate limit for most clients.
- Burst limit: Up to 100 requests within a short burst to accommodate occasional high demand.
- Exceeding Limits: Clients exceeding rate limits will receive a
429 Too Many Requestsstatus code.
Notes
- Ensure the Bearer token provided in the request header is valid.
- Make sure to keep your
clientSecretsecure and do not expose it in client-side code. - This endpoint returns timestamps in Unix epoch format with seconds and nanoseconds for precision.