SegmentOJ后端API文档
SegmentOJ Backend API Documentation
Account
Login (Create Session)
URI: api/account/session
Method:POST
Logout
URI: api/account/session
Method:DELETE
Problem
Problem List
URI: api/problem/list
Method:GET
Query Parameter:
Name | Description | Default Value | Example |
---|---|---|---|
limit | The maximum length of data return each page | 0 |
10 |
offset | The begin point of data | 0 |
50 |
title | Search: title contains this value | optional | A%2BBProblem |
Example Request: /api/problem/list?offset=3&limit=4
Example Response:
{
"count": 105,
"res": [
{
"pid": 1,
"title": "A+B problem",
"enabled": true,
"tags": [
1,
2
],
"score": -1
},
{
"pid": 2,
"title": "Hello, SOJ",
"enabled": true,
"tags": [
1,
2,
3
],
"score": -1
},
]
}
Error Response:
- 400 Bad Request
Problem List Item Count
This API was removed.
Get problem infomation
URI: api/problem/:id
Method:GET
URI Parameter:
Name | Description | Example |
---|---|---|
id | The problem ID | 2 |
Example Response:
{
"res": {
"pid": 6,
"date_added": "2020-08-10T10:34:17.633144+08:00",
"title": "[CQOI2014] 危桥",
"allow_html": false,
"tags": [
5,
6,
7
],
"enabled": true,
"memory_limit": 125000,
"time_limit": 1000
}
}
Error Response:
- 400 Bad Request
- 403 Forbidden
- 404 Not Found
Get Problem Content
URI: api/problem/:id/description
Method: GET
Name | Description | Example |
---|---|---|
id | The problem ID | 2 |
Example Response:
{
"res": {
"description": "Problem description in markdown, too long, skipped for the length limit of documention"
}
}
Error Response:
- 400 Bad Request
- 403 Forbidden
- 404 Not Found
Delete Problem
URI: api/problem/:id
Method:DELETE
URI Parameter:
Name | Description | Example |
---|---|---|
id | The problem ID | 2 |
Response:
- 204 No Content
Error Response:
- 400 Bad Request
- 403 Forbidden
- 404 Not Found
Tag List
URI: api/problem/tag/list
Method: GET
Example Response:
{
"count": 4,
"res": [
{
"id": 1,
"content": "System Test",
"color": "black"
},
{
"id": 2,
"content": "Easy",
"color": "red"
},
{
"id": 3,
"content": "Special Judge",
"color": "red"
}
]
}
Error Response:
None in thoery.
Get Tag Content
URI: api/problem/tag/:id
Method: GET
URI Parameter:
Name | Description | Example |
---|---|---|
id | The Tag ID | 2 |
Update Tag Content
URI: api/problem/tag/:id
Method: Patch
URI Parameter:
Name | Description | Example |
---|---|---|
id | The Tag ID | 2 |
Create New Tag
URI: api/problem/tag
Method: POST
Status
Status List
URI: api/status/list
Method: GET
Query Parameter:
Name | Description | Default Value | Example |
---|---|---|---|
limit | The maximum length of data return each page | 0 |
10 |
offset | The begin point of data | 0 |
50 |
Example Response: |
{
"count": 157,
"res": [
{
"id": 157,
"add_time": "2020-08-15T11:35:10.079983+08:00",
"score": 0,
"lang": 0,
"time": 0,
"memory": 0,
"owner": 1,
"problem": 1,
"state": 1
},
{
"id": 156,
"add_time": "2020-08-15T11:35:09.748617+08:00",
"score": 100,
"lang": 0,
"time": 50,
"memory": 500,
"owner": 1,
"problem": 1,
"state": 10
}
]
}
Status Detail
URI: api/status/:id
Method: GET
URI Parameter:
Name | Description | Example |
---|---|---|
id | The Status ID | 105 |
Example Response:
{
"res": {
"id": 154,
"score": 0,
"state": 14,
"time": 0,
"memory": 0,
"lang": 0,
"code": "Status Code Content, too long, skipped for the length limit of documention",
"add_time": "2020-08-15T11:35:09.128207+08:00",
"owner": 1,
"problem": 1
}
}
Submit Problem (Create Status)
URI: api/status
Method: POST
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~