跳到正文
cccskills
免费在 GitHub 公开

api

How to reach the platform REST API — where prod and dev live, where the API token is (.env), how to authenticate with curl, and how to fetch the OpenAPI spec listing every endpoint. Use whenever you need to read or edit course/homework/project/registration data, or inspect real prod data while debugging.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md5.4 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Platform REST API (/api/)

Everything the platform exposes for courses, homeworks, projects, questions, and registration campaigns is available as JSON under /api/. This skill tells you how to connect and how to discover the endpoints; the live OpenAPI spec is the source of truth for the exact routes and payloads.

Where things live

InstanceBase URLToken (in .env)
Productionhttps://courses.datatalks.clubAUTH_TOKEN
Devhttps://dev.courses.datatalks.clubDEV_AUTH_TOKEN

Default to dev when experimenting. Use prod read-only unless you explicitly intend to change production data.

The API token

Tokens are DRF-style Tokens stored in each instance's own database, so a prod token works only on prod and a dev token only on dev. Both are kept in the project's .env file (not exported as shell vars), as AUTH_TOKEN and DEV_AUTH_TOKEN.

Read the right token out of .env without printing it:

# prod
TOKEN=$(grep -E '^AUTH_TOKEN=' .env | cut -d= -f2- | tr -d '"'\'' \r')
# dev
TOKEN=$(grep -E '^DEV_AUTH_TOKEN=' .env | cut -d= -f2- | tr -d '"'\'' \r')

Authenticate

Every endpoint except /api/health/ needs this header:

Authorization: Token <key>
curl -s -H "Authorization: Token $TOKEN" \
  "https://dev.courses.datatalks.club/api/courses/" | python3 -m json.tool

Write actions (score, delete, some edits) additionally require the token's user to be staff, otherwise you get 403 staff_token_required.

Health / deployed version (no auth — handy to confirm which commit is live):

curl -s https://courses.datatalks.club/api/health/
# {"status": "ok", "version": "20260606-083515-7c464aa"}

Discover all endpoints (OpenAPI)

The spec is generated from the routes and models, so it is always current. Fetch it instead of guessing routes:

# Full spec
curl -s -H "Authorization: Token $TOKEN" \
  "https://dev.courses.datatalks.club/api/openapi.json" | python3 -m json.tool

# Just the list of paths + methods
curl -s -H "Authorization: Token $TOKEN" \
  "https://dev.courses.datatalks.club/api/openapi.json" \
  | python3 -c 'import sys,json;
d=json.load(sys.stdin);
[print(m.upper().ljust(7), p) for p,ms in d["paths"].items() for m in ms]'

Example: inspect a homework (e.g. when debugging a prod issue)

TOKEN=$(grep -E '^AUTH_TOKEN=' .env | cut -d= -f2- | tr -d '"'\'' \r')

# Homework config: state (OP/CL/SC), enabled fields, counts. Note the numeric id.
curl -s -H "Authorization: Token $TOKEN" \
  "https://courses.datatalks.club/api/courses/<course_slug>/homeworks/by-slug/<hw_slug>/" \
  | python3 -m json.tool

# Its questions: types, options, correct answers (uses the id from above)
curl -s -H "Authorization: Token $TOKEN" \
  "https://courses.datatalks.club/api/courses/<course_slug>/homeworks/<hw_id>/questions/" \
  | python3 -m json.tool

Project evaluation fallback

When a project submission has no usable peer evaluation, do not write to the database or create a fake peer review. Use the system-evaluation API. Production POSTs change student data, so make the proposed rubric answers and feedback clear to the user and require explicit authorization for that specific write.

First find the stable submission ID. The project submissions export includes id, student_email, repository details, and the current score:

curl -s -H "Authorization: Token $TOKEN" \
  "https://courses.datatalks.club/api/courses/<course_slug>/projects/<project_slug>/submissions" \
  | python3 -m json.tool

Then inspect the exact submission. This returns its repository, the full rubric, submitted peer evaluations, and prior system evaluations:

curl -s -H "Authorization: Token $TOKEN" \
  "https://courses.datatalks.club/api/courses/<course_slug>/projects/by-slug/<project_slug>/submissions/<submission_id>/system-evaluations/" \
  | python3 -m json.tool

After evaluating the project, POST one answer for every rubric criterion plus written feedback. Answers are one-based option indexes; checkbox answers are comma-separated. Use a stable incident or support reference as the idempotency key so retries cannot duplicate the evaluation:

curl -s -X POST \
  -H "Authorization: Token $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "idempotency_key": "support-issue-123-attempt-1",
    "feedback": "Specific, student-facing feedback.",
    "criteria_responses": [
      {"criteria_id": 101, "answer": "3"},
      {"criteria_id": 102, "answer": "1,2"}
    ]
  }' \
  "https://courses.datatalks.club/api/courses/<course_slug>/projects/by-slug/<project_slug>/submissions/<submission_id>/system-evaluations/" \
  | python3 -m json.tool

The endpoint requires a staff token, records the token user as the author, combines the system response with peer responses for project scoring, and does not award peer-review participation credit. A new evaluation returns 201; an exact idempotent replay returns 200; reusing the key for different content returns 409.

Where the code is

  • Routes: api/urls.py
  • Views: api/views/
  • OpenAPI generator: api/openapi.py

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Investigate and resolve Course Management Platform CloudWatch alert issues end to end. Use when Codex is asked to inspect a CMP GitHub alert issue, pull dev or production AWS logs, diagnose 5xx responses or failed background work, fix an incident with test-driven development, validate a fix in dev, or deploy and verify an authorized production fix.

中文简介正在准备中。当前显示原文说明。

DataTalksClub/course-management-platform862026年10月19日 更新

verify

免费

Run this Django app locally against a throwaway database and drive its pages over HTTP to observe a change working. Use when verifying student/cadmin page behavior end-to-end.

中文简介正在准备中。当前显示原文说明。

DataTalksClub/course-management-platform862026年10月19日 更新

查看 DataTalksClub 的全部技能

报告此技能的问题