Classroom
| 产品详情
  • assemble
    • 习题判题ExecuteExercise
    • 查询习题库下习题列表ListExercises
    • 查询当前租户的习题库列表ListPackages
    • 查询单个习题详情ShowExerciseDetail
    • 查询单个习题库详情ShowPackageDetail
  • baseresource
    • 获取习题所有难度ListAllDifficults
    • 获取自身习题知识点ListMyKnowledgePoints
  • classroom
    • 根据课堂ID获取指定课堂的课堂成员列表ListClassroomMembers
    • 获取当前用户的课堂列表ListClassrooms
    • 根据课堂ID获取指定课堂的详细信息ShowClassroomDetail
  • job
    • 查询课堂下指定成员的作业信息ListClassroomMemberJobs
    • 查询指定课堂下的作业列表信息ListJobs
    • 查询学生函数习题提交记录信息ListMemberJobRecords
    • 根据作业ID,查询指定作业的信息ShowJobDetail
    • 查询指定作业下的习题信息ShowJobExercises
  • 判题使能
    • 下发判题任务ApplyJudgement
    • 获取判题结果详情ShowJudgementDetail
    • 下载判题结果文件ShowJudgementFile

ApplyJudgement

下发判题任务

POST
https://classroom-ext.cn-north-4.myhuaweicloud.com/v1/enablement/judgements
高级设置
只看必填项
填写默认值
密文显示特定参数
*
Region
Headers
*
Authorization
Body
*{
*
notify_url
:
*
code_type
:
*
source_code
:
*
description
:
*
runtime_type
:
*
timeout
:
*
output_type
:
*
testcases
: [
* {
*
input
:
*
output
:
*}
+Add
*]
}

功能介绍

下发判题任务,根据回调地址、代码来源、源代码文本、语言类型、超时时长、输出类型,触发后台代码编译运行和判题

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

POST /v1/enablement/judgements

请求参数

表1 请求Header参数

参数

是否必选

参数类型

描述

x-auth-token

String

用户token

表2 请求Body参数

参数

是否必选

参数类型

描述

notify_url

String

第三方指定的判题结果回调url,取值来源于伙伴通道“判题管理配置”-“接口管理”中设置的回调地址相同

最小长度:1

最大长度:255

code_type

String

代码来源:inline(源代码)

缺省值:inline

最小长度:1

最大长度:32

枚举值:

  • inline

source_code

String

源代码,需Base64编码

最小长度:0

最大长度:30000

description

String

任务描述

最小长度:0

最大长度:255

runtime_type

String

支持语言类型:java、c、cpp、python

最小长度:1

最大长度:32

枚举值:

  • java

  • c

  • cpp

  • python

timeout

Integer

代码运行超时时间,单位为秒

最小值:1

最大值:60

output_type

String

结果返回类型:sysout(标准输出)、fileout(以文件形式输出)、imgout(以图片形式输出)、caseout(用例运行返回)、judgeout(用例对比返回)

最小长度:1

最大长度:32

枚举值:

  • sysout

  • fileout

  • imgout

  • caseout

  • judgeout

testcases

Array of JudgementCaseInfo objects

当判题结果类型是caseout和judgeout类型才需要传的字段,表示用例数据

表3 JudgementCaseInfo

参数

是否必选

参数类型

描述

input

String

用例数据输入

output

String

用例数据期望输出

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

judgement_id

String

判题任务ID

状态码: 400

表5 响应Body参数

参数

参数类型

描述

error_code

String

异常错误码

error_msg

String

异常错误描述

状态码: 403

表6 响应Body参数

参数

参数类型

描述

error_code

String

异常错误码

error_msg

String

异常错误描述

状态码: 500

表7 响应Body参数

参数

参数类型

描述

error_code

String

异常错误码

error_msg

String

异常错误描述

请求示例

  • {
      "notify_url" : "https://117.12.143.1/taskBack",
      "code_type" : "inline",
      "source_code" : "I2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oKSB7CiAgICBzdGQ6OmNvdXQgPDwgIkhlbGxvIHdvcmxkISIgPDwgc3RkOjplbmRsOwogICAgcmV0dXJuIDA7Cn0=",
      "description" : "cpp code",
      "runtime_type" : "cpp",
      "timeout" : 60,
      "output_type" : "sysout"
    }
  • {
      "notify_url" : "https://117.12.143.1/taskBack",
      "code_type" : "inline",
      "source_code" : "bnVtID0gaW5wdXQoKQpudW1zID0gbnVtLnNwbGl0KCkKcHJpbnQoaW50KG51bXNbMF0pK2ludChudW1zWzFdKSk=",
      "description" : "python code",
      "runtime_type" : "python",
      "timeout" : 10,
      "output_type" : "judgeout",
      "testcases" : [ {
        "input" : "10 20",
        "output" : "30"
      } ]
    }

响应示例

状态码: 200

下发判题任务成功

{
  "judgement_id" : "9a780fd55cd64333b668ba26132629d2"
}

状态码: 400

Bad Request

{
  "error_code" : "CM.0003",
  "error_msg" : "请求参数有误"
}

状态码: 403

Forbidden

{
  "error_code" : "CM.0001",
  "error_msg" : "请求被拒绝访问"
}

状态码: 500

Internal Server Error

{
  "error_code" : "CM.0000",
  "error_msg" : "服务内部错误"
}

状态码

状态码

描述

200

下发判题任务成功

400

Bad Request

403

Forbidden

500

Internal Server Error

错误码

请参见错误码

变更历史
2023-06-21
下发判题任务
POST
   ApplyJudgement
修改
变更参数

本文导读

功能介绍
调试
URI
请求参数
响应参数
请求示例
响应示例
状态码
错误码
变更历史