Learn Machine Learning

Learn Machine Learning · Actions GPT

LabEx API

LabEx API v2

  • GET /api/v2/lab/{lab_id}/steps获取实验步骤
  • GET /api/v2/paths/{alias}获取 Skilltree 详情
  • GET /api/v2/paths/{alias}/labs获取 Skilltree 的 Lab 列表
  • GET /api/v2/skilltree/{alias}获取 Skilltree 的 Skill 列表
Schéma original API
{
  "openapi": "3.0.3",
  "info": {
    "title": "LabEx API",
    "description": "LabEx API v2",
    "version": "0.0.1"
  },
  "servers": [
    {
      "url": "https://labex.io"
    }
  ],
  "paths": {
    "/api/v2/lab/{lab_id}/steps": {
      "get": {
        "tags": [
          "LabService"
        ],
        "summary": "获取实验步骤",
        "operationId": "LabService_GetLabSteps",
        "parameters": [
          {
            "name": "lab_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/labex.v2.GetLabStepsReply"
                }
              }
            }
          },
          "default": {
            "description": "Default error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/google.rpc.Status"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/paths/{alias}": {
      "get": {
        "tags": [
          "PathService"
        ],
        "summary": "获取 Skilltree 详情",
        "operationId": "PathService_GetPath",
        "parameters": [
          {
            "name": "alias",
            "in": "path",
            "description": "SkillTree alias",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "need_learning_info",
            "in": "query",
            "description": "(ignore) 获取用户的课程学习情况",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/labex.v2.GetPathResponse"
                }
              }
            }
          },
          "default": {
            "description": "Default error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/google.rpc.Status"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/paths/{alias}/labs": {
      "get": {
        "tags": [
          "PathService"
        ],
        "summary": "获取 Skilltree 的 Lab 列表",
        "operationId": "PathService_ListPathLabs",
        "parameters": [
          {
            "name": "alias",
            "in": "path",
            "description": "skilltree alias",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "query",
            "in": "query",
            "description": "用户查询",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "difficulties",
            "in": "query",
            "description": "过滤难度,枚举:Beginner、Intermediate、Advanced",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "skills",
            "in": "query",
            "description": "过滤 skill key",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "fee_types",
            "in": "query",
            "description": "fee type 0: 免费 1: 付费 2: 会员",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          {
            "name": "types",
            "in": "query",
            "description": "过滤 Lab 类型,枚举:lab、challenge、project",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "statuses",
            "in": "query",
            "description": "0 已学过未完成 1 已学过已完成 2 未学过",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "enum"
              }
            }
          },
          {
            "name": "pagination.current",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pagination.size",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pagination.total_pages",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "pagination.total_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/labex.v2.ListPathLabsResponse"
                }
              }
            }
          },
          "default": {
            "description": "Default error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/google.rpc.Status"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/skilltree/{alias}": {
      "get": {
        "tags": [
          "SkillTreeService"
        ],
        "summary": "获取 Skilltree 的 Skill 列表",
        "operationId": "SkillTreeService_GetSkillTree",
        "parameters": [
          {
            "name": "alias",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/labex.v2.GetSkillTreeReply"
                }
              }
            }
          },
          "default": {
            "description": "Default error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/google.rpc.Status"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "google.protobuf.Any": {
        "type": "object",
        "properties": {
          "@type": {
            "type": "string",
            "description": "The type of the serialized message."
          }
        },
        "additionalProperties": true,
        "description": "Contains an arbitrary serialized message along with a @type that describes the type of the serialized message."
      },
      "google.rpc.Status": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].",
            "format": "int32"
          },
          "message": {
            "type": "string",
            "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client."
          },
          "details": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/google.protobuf.Any"
            },
            "description": "A list of messages that carry the error details.  There is a common set of message types for APIs to use."
          }
        },
        "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors)."
      },
      "labex.v2.GetLabStepsReply": {
        "type": "object",
        "properties": {
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/labex.v2.model.LabStep"
            }
          }
        }
      },
      "labex.v2.GetPathResponse": {
        "type": "object",
        "properties": {
          "path": {
            "allOf": [
              {
                "$ref": "#/components/schemas/labex.v2.model.Path"
              }
            ],
            "description": "SkillTree detail"
          },
          "team": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/labex.v2.model.BasicTeam"
            },
            "description": "(ignore) SkillTree 关联的 Team 信息"
          }
        }
      },
      "labex.v2.GetSkillTreeReply": {
        "type": "object",
        "properties": {
          "skilltree": {
            "$ref": "#/components/schemas/labex.v2.model.SkillTree"
          }
        }
      },
      "labex.v2.ListPathLabsResponse": {
        "type": "object",
        "properties": {
          "pagination": {
            "$ref": "#/components/schemas/labex.v2.Pagination"
          },
          "labs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/labex.v2.model.Lab"
            }
          }
        }
      },
      "labex.v2.Pagination": {
        "type": "object",
        "properties": {
          "current": {
            "type": "integer",
            "format": "int32"
          },
          "size": {
            "type": "integer",
            "format": "int32"
          },
          "total_pages": {
            "type": "integer",
            "format": "int32"
          },
          "total_size": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "labex.v2.model.BasicCourse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "alias": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "cover": {
            "type": "string"
          },
          "user_count": {
            "type": "integer",
            "format": "int32"
          },
          "level": {
            "type": "integer",
            "format": "enum"
          },
          "fee_type": {
            "type": "integer",
            "format": "enum"
          },
          "lab_coins": {
            "type": "integer",
            "format": "int32"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "learning_info": {
            "$ref": "#/components/schemas/labex.v2.model.CourseLearningInfo"
          },
          "type": {
            "type": "integer",
            "format": "enum"
          },
          "status": {
            "type": "integer",
            "format": "enum"
          },
          "has_cert": {
            "type": "boolean"
          }
        }
      },
      "labex.v2.model.BasicSkill": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "learned": {
            "type": "boolean"
          }
        }
      },
      "labex.v2.model.BasicTeam": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "logo": {
            "type": "string"
          },
          "has_shared_credits": {
            "type": "boolean"
          }
        }
      },
      "labex.v2.model.CourseLearningInfo": {
        "type": "object",
        "properties": {
          "labs_count": {
            "type": "integer",
            "format": "int32"
          },
          "learned_labs": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            }
          },
          "current_lab_index": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "labex.v2.model.Lab": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "fee_type": {
            "type": "integer",
            "description": "付费类型,0=免费学习,1=付费学习,2=订阅Pro后可学习",
            "format": "enum"
          },
          "type": {
            "type": "integer",
            "description": "实验类型,0=Lab,1=Challenge,2=Project",
            "format": "enum"
          },
          "difficulty": {
            "type": "string",
            "description": "实验难度,枚举:Beginner、Intermediate、Advanced"
          },
          "time": {
            "type": "integer",
            "description": "预计学习实验所需的分钟数",
            "format": "int32"
          },
          "from_community": {
            "type": "boolean",
            "description": "(ignore)"
          },
          "description": {
            "type": "string"
          },
          "max_lab_num": {
            "type": "integer",
            "description": "最大实验次数",
            "format": "int32"
          },
          "allow_to_start": {
            "type": "boolean",
            "description": "用户是否可以运行该实验"
          },
          "remain_num": {
            "type": "integer",
            "description": "剩余实验次数",
            "format": "int32"
          },
          "is_finished": {
            "type": "boolean"
          },
          "default_console_type": {
            "type": "integer",
            "format": "enum"
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "user_learning_status": {
            "type": "integer",
            "format": "enum"
          },
          "course_id": {
            "type": "integer",
            "format": "int32"
          },
          "course_index": {
            "type": "integer",
            "description": "lab在课程中的顺序",
            "format": "int32"
          },
          "allow_to_view": {
            "type": "boolean",
            "description": "用户是否可以查看文档"
          },
          "skilltrees": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "open_source_url": {
            "type": "string"
          }
        }
      },
      "labex.v2.model.LabStep": {
        "type": "object",
        "properties": {
          "position": {
            "type": "integer",
            "description": "(ignore) step position",
            "format": "int32"
          },
          "title": {
            "type": "string"
          },
          "layout": {
            "type": "string",
            "description": "(ignore) step layout"
          },
          "text": {
            "type": "string",
            "description": "step content (in markdown format)"
          },
          "need_verify": {
            "type": "boolean",
            "description": "(ignore)"
          },
          "has_solution": {
            "type": "boolean",
            "description": "(ignore)"
          }
        }
      },
      "labex.v2.model.Path": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "alias": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "img_url": {
            "type": "string"
          },
          "course_count": {
            "type": "integer",
            "format": "int32"
          },
          "hours": {
            "type": "integer",
            "description": "学习时间",
            "format": "int32"
          },
          "enable_uid": {
            "type": "boolean",
            "description": "关注路径需要填写 aliyun uid"
          },
          "skills_count": {
            "type": "integer",
            "format": "int32"
          },
          "labs_count": {
            "type": "integer",
            "format": "int32"
          },
          "challenges_count": {
            "type": "integer",
            "format": "int32"
          },
          "projects_count": {
            "type": "integer",
            "format": "int32"
          },
          "is_online": {
            "type": "boolean"
          },
          "is_followed": {
            "type": "boolean"
          },
          "has_cert": {
            "type": "boolean"
          },
          "cert_threshold": {
            "type": "integer",
            "format": "int32"
          },
          "description": {
            "type": "string"
          },
          "levels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/labex.v2.model.PathLevel"
            }
          }
        }
      },
      "labex.v2.model.PathLevel": {
        "type": "object",
        "properties": {
          "level": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "courses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/labex.v2.model.BasicCourse"
            }
          }
        }
      },
      "labex.v2.model.SkillTree": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "subjects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/labex.v2.model.SkillTree_Subject"
            }
          }
        }
      },
      "labex.v2.model.SkillTree_Subject": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/labex.v2.model.Subject_Group"
            }
          }
        }
      },
      "labex.v2.model.Subject_Group": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "skills": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/labex.v2.model.BasicSkill"
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "AdminService"
    },
    {
      "name": "AuthService",
      "description": "认证服务"
    },
    {
      "name": "BotService"
    },
    {
      "name": "CertService"
    },
    {
      "name": "CloudLabService",
      "description": "云实验服务"
    },
    {
      "name": "CommentService"
    },
    {
      "name": "ContestService",
      "description": "比赛服务"
    },
    {
      "name": "CourseService",
      "description": "课程服务"
    },
    {
      "name": "CreditsService",
      "description": "credits service"
    },
    {
      "name": "FileService"
    },
    {
      "name": "ForumService",
      "description": "论坛服务"
    },
    {
      "name": "LabService",
      "description": "The lab service definition."
    },
    {
      "name": "LabbyService"
    },
    {
      "name": "OAuthService",
      "description": "OAuth 认证服务"
    },
    {
      "name": "PathService",
      "description": "Path/Skilltree 服务"
    },
    {
      "name": "PaypalService"
    },
    {
      "name": "SkillTreeService"
    },
    {
      "name": "SubscriptionService",
      "description": "订阅服务"
    },
    {
      "name": "TaskService",
      "description": "任务队列"
    },
    {
      "name": "TeamService"
    },
    {
      "name": "UserService",
      "description": "用户服务"
    },
    {
      "name": "VMService",
      "description": "环境服务"
    },
    {
      "name": "WebhookService"
    }
  ]
}