运行代码
POST
/v1/code/run
Code
请求参数
Body 参数application/json
lang
enum<string>
可选
枚举值:
ccppgolangjavapythonrust
默认值:
c
code
string
程序源代码
input
string
程序输入内容
time
integer <int64>
限定运行时间(单位: ms [0, 2000])
memory
integer <int64>
限定程序使用内存(单位: mb [1, 256])
outMsgLimit
integer <int64>
限定输出内容大小(0 表示使用默认值,单位: kb)
示例
{
"lang": "c",
"code": "string",
"input": "string",
"time": 0,
"memory": 0,
"outMsgLimit": 0
}
示例代码
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://test-cn.your-api-server.com/v1/code/run' \
--header 'Content-Type: application/json' \
--data-raw ''
返回响应
🟢200A successful response.
application/json
Body
outPut
string
程序输出
cpuTimeUsage
number <double>
程序运行Cpu耗时(ms)
realTimeUsage
number <double>
程序运行总耗时(ms)
memoryUsage
number <double>
程序使用内存(kb)
state
enum<string>
可选
枚举值:
CEACWARETLEMLEUE
默认值:
CE
示例
{
"outPut": "string",
"cpuTimeUsage": 0,
"realTimeUsage": 0,
"memoryUsage": 0,
"state": "CE"
}
🔴500An unexpected error response.
修改于 2023-12-04 12:32:17