API to run the code
Users can integrate the API from their backend servers and execute the code programatically.
Following is the cURL to call the /run
API to execute code
curl --location --request POST 'https://onecompiler.com/api/v1/run?access_token=your_access_token' \
--header 'Content-Type: application/json' \
--data-raw '{
"language": "python",
"stdin": "Peter",
"files": [
{
"name": "HelloWorld.py",
"content": "import sys\nname = sys.stdin.readline()\nprint('\''Hello '\''+ name)"
}
]
}'
Response:
{
"status": "success",
"exception": null,
"stdout": "Hello Peter\n",
"stderr": null,
"executionTime": 41,
"limitPerMonthRemaining": 74694
}
Note: Replace the your_access_token
with your account's access token. Reach out to [email protected] to get your acces token