搜索
/v1/code/execute 提供统一代码执行入口。沙盒会根据语言把代码路由到对应运行时。
/v1/code/execute
如果需要运行时专属的会话管理或高级参数,请使用 Jupyter 或 Node.js API。
curl -X POST "http://localhost:8080/v1/code/execute" \ -H "Content-Type: application/json" \ -d '{ "language": "python", "code": "print(sum([1, 2, 3]))" }'
curl -X POST "http://localhost:8080/v1/code/execute" \ -H "Content-Type: application/json" \ -d '{ "language": "javascript", "code": "console.log([1, 2, 3].reduce((a, b) => a + b, 0));" }'
curl "http://localhost:8080/v1/code/info"
请求成功不代表代码执行成功。调用方仍需检查响应中的执行状态和输出字段。详见 错误处理。