SCUPI_OJ
  1. 题目操作
SCUPI_OJ
  • SCUPIOJ
    • 用户系统
      • 操作认证
      • 账号增删改查
        • 05 老师管理员获取系统全部用户
        • 04 获取单个用户的信息
        • 06 修改账号密码
        • 07 管理员创建用户
        • 08 管理员删除用户
      • 01 登录
      • 02 注销
      • 03 assess token续期
    • 班级系统
      • 09 管理员创建班级
      • 10 管理员删除班级
      • 11 管理员编辑班级成员
      • 12 获取班级中的成员
      • 13 获取此用户所加入的班级
    • 作业系统
      • 作业与题目关系说明
      • 题目系统
        • 题目操作
          • 23 在作业中新建题目
            POST
          • 24 获取作业中题目 v2
            GET
          • 25 修改作业中题目内容
            PUT
          • 26 删除作业中题目
            DELETE
          • 39 获取作业中所有题目得分细则(每道题的得分)
            GET
          • 44 获取作业中单个题目
            GET
        • 增删改查代码答案
          • 说明
          • 30 创建代码作业答案
          • 31 获取代码答案
          • 32 修改代码答案
          • 33 删除代码答案
        • 回答题目与人工判题操作
          • 34 回答题目
          • 35 查看全班成员在特定题目的最新提交记录
          • 36 查询特定学生在某题目的全部提交记录
          • 37 为题目评分
          • 38 删除答题记录
          • 43 运行代码
        • 图片
          • 27 上传图片
          • 28 查看图片
          • 29 删除图片
      • 19 获取课程中布置的作业 v2
        GET
      • 40 获取设定的作业总分数
        GET
      • 41 获取特定学生的作业总分
        GET
      • 42 获取所有学生作业总得分
        GET
      • 20 布置作业
        POST
      • 21 更改作业信息
        PUT
      • 22 删除作业
        DELETE
    • 信息系统操作
      • 14 获取用户发送信息
      • 15 获取用户接收信息
      • 16 创建新信息
      • 17 修改已读状态
      • 18 删除信息
  1. 题目操作

23 在作业中新建题目

测试中
POST
http://127.0.0.1:8000/home/<str:coursename>/<str:assignmentname>/
OJ

只有老师和管理员可以调用
在str:coursename班级,str:assignmentname作业中新建题目,body为一个列表,可以同时布置多个题目,题目的图片用其他api处理
参数讲解:
title 题目的标题 必填(创建之后不可修改)
content_problem 题目的具体信息 必填
score 题目的分值 必填
type 题目的类型,有三种可选‘programming’,‘text’,‘choice' 必填
response_limit 学生在此题目尝试的最大次数 可不填,不填则视为无限制
non_programming_answer 在题目不是代码题时题目的答案,必填,后端会根据其中内容进行判分,如果题目是代码题这个字段可以不填,会有其他的接口来处理代码题目的答案

若运行成功直接返回创建的题目

#题目答案规则:non_programming_answer中储存选择题和简答题的答案
答案均由"<-&&->"包裹,比如在多选题中答案为a,c,e,non_programming_answer应填"<-&a&-><-&c&-><-&e&->"
在简答题中如为多空简答题,第一个空的答案为“床前明月光”第二个空的答案为“疑是地上霜”,则non_programming_answer应填"<-&床前明月光&-><-&疑是地上霜&->"注意多空简答题答案一一对应,顺序不能错

请求参数

Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
Body 参数application/json
array of:
title
string 
必需
content_problem
string 
必需
score
integer 
必需
type
string 
必需
response_limit
integer  | null 
必需
non_programming_answer
string  | null 
必需
示例
[
  {
    "title": "Problem 1",
    "content_problem": "Describe the process of normalization in databases.",
    "score": 10,
    "type": "text",
    "response_limit": 500,
    "non_programming_answer": "Normalization is the process of organizing data in a database..."
  },
  {
    "title": "Problem 2",
    "content_problem": "What is the time complexity of a binary search algorithm?",
    "score": 5,
    "type": "choice",
    "response_limit": null,
    "non_programming_answer": "<-&a&->"
  },
  {
    "title": "Problem 3",
    "content_problem": "Write a function to reverse a string.",
    "score": 15,
    "type": "programming",
    "response_limit": null,
    "non_programming_answer": null
  }
]

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://127.0.0.1:8000/home/<str:coursename>/<str:assignmentname>/' \
--header 'Content-Type: application/json' \
--data-raw '[
    {
        "title": "Problem 1",
        "content_problem": "Describe the process of normalization in databases.",
        "score": 10,
        "type": "text",
        "response_limit": 500,
        "non_programming_answer": "Normalization is the process of organizing data in a database..."
    },
    {
        "title": "Problem 2",
        "content_problem": "What is the time complexity of a binary search algorithm?",
        "score": 5,
        "type": "choice",
        "response_limit": null,
        "non_programming_answer": "<-&a&->"
    },
    {
        "title": "Problem 3",
        "content_problem": "Write a function to reverse a string.",
        "score": 15,
        "type": "programming",
        "response_limit": null,
        "non_programming_answer": null
    }
]'

返回响应

🟢201成功
application/json
Body
array of:
id
integer 
数据库中作业id
必需
title
string 
必需
content_problem
string 
必需
score
integer 
必需
type
string 
必需
response_limit
integer  | null 
必需
non_programming_answer
string  | null 
必需
示例
[
  {
    "id": 1,
    "title": "Problem 1",
    "content_problem": "Describe the process of normalization in databases.",
    "score": 10,
    "type": "text",
    "response_limit": 500,
    "non_programming_answer": "Normalization is the process of organizing data in a database..."
  },
  {
    "id": 2,
    "title": "Problem 2",
    "content_problem": "What is the time complexity of a binary search algorithm?",
    "score": 5,
    "type": "choice",
    "response_limit": null,
    "non_programming_answer": "<-&a&->"
  },
  {
    "id": 3,
    "title": "Problem 3",
    "content_problem": "Write a function to reverse a string.",
    "score": 15,
    "type": "programming",
    "response_limit": null,
    "non_programming_answer": null
  }
]
上一页
作业与题目关系说明
下一页
24 获取作业中题目 v2
Built with