Head over to the meta repo for help on getting started with this project. Technical documentation will be available in the repo Wiki eventually.
orange🟠 Code Runner Server
- Endpoint:
/api/v2/execute
- Method:
POST
- Required headers:
Content-Type
,Authorization
- Endpoint:
/api/v2/info
- Method:
GET
- Required headers:
Content-Type
,Authorization
- Endpoint:
/api/v1/execute
- Method:
POST
- Required headers:
Content-Type
,Authorization
Content-Type
must beapplication/json
- Authorisation header must contain a valid token (generable using script
npm run gen-token <secret> <identifier>
)
API V2 is a small update at the moment. Most Features of API v1 work in v2 plus the v2 additions. See comment for each schema for additional info.
/* JSON format */
type request_schema = {
code: string,
lang: string,
version: string, // API V2 only
runtime: string, // API V2 only
stdin?: string,
args?: string[]
}
/* JSON format */
type reply_schema = {
id: string,
data: any
}
The
data
property contains the entire response produced by the Piston code execution engine in JSON format. Consult the Piston docs for more info or see the below example:
HTTP/1.1 200 OK
Content-Type: application/json
{
"run": {
"stdout": "[\n '/piston/packages/node/15.10.0/bin/node',\n '/piston/jobs/e87afa0d-6c2a-40b8-a824-ffb9c5c6cb64/my_cool_code.js',\n '1',\n '2',\n '3'\n]\n",
"stderr": "",
"code": 0,
"signal": null,
"output": "[\n '/piston/packages/node/15.10.0/bin/node',\n '/piston/jobs/e87afa0d-6c2a-40b8-a824-ffb9c5c6cb64/my_cool_code.js',\n '1',\n '2',\n '3'\n]\n"
},
"language": "javascript",
"version": "15.10.0"
}
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"language": "bash",
"version": "5.1.0",
"aliases": ["sh"]
},
{
"language": "javascript",
"version": "15.10.0",
"aliases": ["node-javascript", "node-js", "javascript", "js"],
"runtime": "node"
}
]