提交
一批要批改的作业。文件、轮次和批改结果都属于一次提交。
POST /v3/submissions
新建一次提交。新建的提交是草稿:它还没有文件,也没有轮次。响应头 Location 是新提交的地址。
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
Idempotency-Key |
请求头 | 字符串 | 否 | 幂等键,由调用方任意生成。用同一个键重发同一个请求时,服务器返回第一次创建的资源,不再创建一个 |
请求体是 JSON。请求体里出现下表之外的字段时,服务器返回 422。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
title |
字符串 或 null | 否 | 提交的标题。省略时系统用创建的时刻生成一个。1 到 80 个字符 |
成功时返回 201,响应体是新建的提交,结构见提交。
出错时的响应体见错误。
| 状态码 | 含义 |
|---|---|
400 |
请求体不是合法的 JSON |
401 |
没有凭据,或者凭据无效 |
403 |
凭据有效,但这个操作不被允许 |
422 |
请求的内容不合规则 |
429 |
请求太频繁 |
curl -X POST "https://homework.api.truezir.com/v3/submissions" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"title":"七年级物理第三单元作业"}'{ "id": "submission-3f9c1a7b2e4d4c6f8a0b9d1e5c7f3a21", "title": "七年级物理第三单元作业", "state": "succeeded", "features": { "study_guide_enabled": true }, "file_counts": { "homework": 3, "reference": 1 }, "item_counts": { "pending": 0, "running": 0, "succeeded": 42, "failed": 0 }, "latest_round": { "id": "round-5d2a8c41e7b94f0d9a3b6c1e8f2d7a90", "sequence": 1, "kind": "initial", "state": "succeeded", "failure_reason": null, "instruction": "按参考答案批改,步骤分按评分标准给", "target_item_ids": null, "file_ids": [ "file-91c4e2b7a6d84f3e8b5a0c7d2e9f1a63" ], "retry_of_round_id": null, "summary": "已批改 42 份作业,其中 3 份字迹无法辨认的题目标为疑问。", "changed_item_count": 42, "created_at": "2026-11-20T06:30:00Z", "started_at": "2026-11-20T06:30:04Z", "finished_at": "2026-11-20T06:41:37Z", "deadline_at": "2026-11-20T07:30:04Z", "cancel_requested_at": null }, "export_state": "ready", "created_at": "2026-11-20T06:27:30Z", "updated_at": "2026-11-20T06:42:10Z"}GET /v3/submissions
分页返回账号的提交,新的在前。
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
limit |
查询参数 | 整数 | 否 | 一页的条数。默认是 30 |
cursor |
查询参数 | 字符串 | 否 | 上一页响应里的 next_cursor。省略时读取第一页 |
成功时返回 200,响应体是一页提交。
| 字段 | 类型 | 说明 |
|---|---|---|
data |
提交的数组 | 这一页的提交 |
next_cursor |
字符串 或 null | 读取下一页时作为参数 cursor 传回的值。已经是最后一页时为 null |
last_event_id |
整数 | 读取时这个账号最新一条事件的序号。把它作为账号事件流的参数 after,就能收到此后的每一次变化 |
出错时的响应体见错误。
| 状态码 | 含义 |
|---|---|
401 |
没有凭据,或者凭据无效 |
403 |
凭据有效,但这个操作不被允许 |
422 |
请求的内容不合规则 |
429 |
请求太频繁 |
curl "https://homework.api.truezir.com/v3/submissions" \ -H "Authorization: Bearer $API_KEY"{ "data": [ { "id": "submission-3f9c1a7b2e4d4c6f8a0b9d1e5c7f3a21", "title": "七年级物理第三单元作业", "state": "succeeded", "features": { "study_guide_enabled": true }, "file_counts": { "homework": 3, "reference": 1 }, "item_counts": { "pending": 0, "running": 0, "succeeded": 42, "failed": 0 }, "latest_round": { "id": "round-5d2a8c41e7b94f0d9a3b6c1e8f2d7a90", "sequence": 1, "kind": "initial", "state": "succeeded", "failure_reason": null, "instruction": "按参考答案批改,步骤分按评分标准给", "target_item_ids": null, "file_ids": [ "file-91c4e2b7a6d84f3e8b5a0c7d2e9f1a63" ], "retry_of_round_id": null, "summary": "已批改 42 份作业,其中 3 份字迹无法辨认的题目标为疑问。", "changed_item_count": 42, "created_at": "2026-11-20T06:30:00Z", "started_at": "2026-11-20T06:30:04Z", "finished_at": "2026-11-20T06:41:37Z", "deadline_at": "2026-11-20T07:30:04Z", "cancel_requested_at": null }, "export_state": "ready", "created_at": "2026-11-20T06:27:30Z", "updated_at": "2026-11-20T06:42:10Z" } ], "next_cursor": null, "last_event_id": 1287}GET /v3/submissions/{submission_id}
返回一次提交:它的状态、文件数、条目数和最新的一轮。
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
submission_id |
路径 | 字符串 | 是 | 提交的标识 |
成功时返回 200,响应体是提交,结构见提交。
出错时的响应体见错误。
| 状态码 | 含义 |
|---|---|
401 |
没有凭据,或者凭据无效 |
403 |
凭据有效,但这个操作不被允许 |
404 |
资源不存在,或者不属于当前账号 |
429 |
请求太频繁 |
curl "https://homework.api.truezir.com/v3/submissions/$SUBMISSION_ID" \ -H "Authorization: Bearer $API_KEY"{ "id": "submission-3f9c1a7b2e4d4c6f8a0b9d1e5c7f3a21", "title": "七年级物理第三单元作业", "state": "succeeded", "features": { "study_guide_enabled": true }, "file_counts": { "homework": 3, "reference": 1 }, "item_counts": { "pending": 0, "running": 0, "succeeded": 42, "failed": 0 }, "latest_round": { "id": "round-5d2a8c41e7b94f0d9a3b6c1e8f2d7a90", "sequence": 1, "kind": "initial", "state": "succeeded", "failure_reason": null, "instruction": "按参考答案批改,步骤分按评分标准给", "target_item_ids": null, "file_ids": [ "file-91c4e2b7a6d84f3e8b5a0c7d2e9f1a63" ], "retry_of_round_id": null, "summary": "已批改 42 份作业,其中 3 份字迹无法辨认的题目标为疑问。", "changed_item_count": 42, "created_at": "2026-11-20T06:30:00Z", "started_at": "2026-11-20T06:30:04Z", "finished_at": "2026-11-20T06:41:37Z", "deadline_at": "2026-11-20T07:30:04Z", "cancel_requested_at": null }, "export_state": "ready", "created_at": "2026-11-20T06:27:30Z", "updated_at": "2026-11-20T06:42:10Z"}修改提交的标题
Section titled “修改提交的标题”PATCH /v3/submissions/{submission_id}
修改一次提交的标题。提交的其他内容不能通过这个接口修改。
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
submission_id |
路径 | 字符串 | 是 | 提交的标识 |
请求体是 JSON。请求体里出现下表之外的字段时,服务器返回 422。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
title |
字符串 | 是 | 新的标题。1 到 80 个字符 |
成功时返回 200,响应体是修改后的提交,结构见提交。
出错时的响应体见错误。
| 状态码 | 含义 |
|---|---|
400 |
请求体不是合法的 JSON |
401 |
没有凭据,或者凭据无效 |
403 |
凭据有效,但这个操作不被允许 |
404 |
资源不存在,或者不属于当前账号 |
422 |
请求的内容不合规则 |
429 |
请求太频繁 |
curl -X PATCH "https://homework.api.truezir.com/v3/submissions/$SUBMISSION_ID" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"title":"七年级物理第三单元作业(二班)"}'{ "id": "submission-3f9c1a7b2e4d4c6f8a0b9d1e5c7f3a21", "title": "七年级物理第三单元作业", "state": "succeeded", "features": { "study_guide_enabled": true }, "file_counts": { "homework": 3, "reference": 1 }, "item_counts": { "pending": 0, "running": 0, "succeeded": 42, "failed": 0 }, "latest_round": { "id": "round-5d2a8c41e7b94f0d9a3b6c1e8f2d7a90", "sequence": 1, "kind": "initial", "state": "succeeded", "failure_reason": null, "instruction": "按参考答案批改,步骤分按评分标准给", "target_item_ids": null, "file_ids": [ "file-91c4e2b7a6d84f3e8b5a0c7d2e9f1a63" ], "retry_of_round_id": null, "summary": "已批改 42 份作业,其中 3 份字迹无法辨认的题目标为疑问。", "changed_item_count": 42, "created_at": "2026-11-20T06:30:00Z", "started_at": "2026-11-20T06:30:04Z", "finished_at": "2026-11-20T06:41:37Z", "deadline_at": "2026-11-20T07:30:04Z", "cancel_requested_at": null }, "export_state": "ready", "created_at": "2026-11-20T06:27:30Z", "updated_at": "2026-11-20T06:42:10Z"}DELETE /v3/submissions/{submission_id}
删除一次提交,连同它的文件、轮次和批改结果。删除之后不能恢复。这次提交有轮次在排队或执行时,返回 409 和错误码 submission_active。
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
submission_id |
路径 | 字符串 | 是 | 提交的标识 |
成功时返回 204,没有响应体。
出错时的响应体见错误。
| 状态码 | 含义 |
|---|---|
401 |
没有凭据,或者凭据无效 |
403 |
凭据有效,但这个操作不被允许 |
404 |
资源不存在,或者不属于当前账号 |
409 |
资源当前的状态不允许这个操作 |
429 |
请求太频繁 |
curl -X DELETE "https://homework.api.truezir.com/v3/submissions/$SUBMISSION_ID" \ -H "Authorization: Bearer $API_KEY"