REST API
Documentation for https://www.jdoodle.com/compiler-api/
Endpoints for REST API
https://api.jdoodle.com/v1/execute - can be used to run or compile programs.
https://api.jdoodle.com/v1/credit-spent - used to check the credit spent.
(only POST method supported with Content-Type: application/json)
Input Parameters for the execute API call
clientId | Your Client ID |
clientSecret | Your Client Secret |
script | program to compile and/or execute |
stdin | StdIn |
language | language of the script (refer the supported language list below) |
versionIndex | the version index of the language to be used (refer to the supported languages and versions in the list below) |
compileOnly | true/false - default false. If true, the program will be only compiled, not executed. |
Output Parameters for the execute API call when the execution is successful
Parameter | Description |
output | Output of the program |
statusCode | Status Code of the result |
memory | Memory used by the program |
cpuTime | CPU Time used by the program |
compilationStatus | Only when the "compileOnly" option in the request is true. 1 - error. 0 - success. |
Output Parameters for the execute API call when the execution failed
Parameter | Description |
error | error message |
statusCode | Status Code of the result |
Input Parameters for the "credit-spent" API call
Parameter | Description |
clientId | Client ID for your subscription |
clientSecret | Client Secret for your subscription |
Output Parameters for the "credit-spent" API call when the execution is successful
Parameter | Description |
used | No of credits used today |
Output Parameters for the "credit-spent" API call when the execution failed
Parameter | Description |
error | error message |
statusCode | Status Code of the result |
Language Codes and Version Index
Please refer - Language Codes and Versions
Java Example for the Execute API Call
The below is a quick and dirty Java example, but please use your favourite rest API client and JSON Java libraries for clean code for production use.
NodeJs Example for the Execute API Call
Curl Example for the execute API Call
The below is a curl example (note: may need slight syntax change in windows)
Curl Example for the "credit-spent" API Call
The below is a curl example (note: may need slight syntax change in windows)
Postman Examples
Right-click the below JSON file and save it in your system, then import the file to your postman and change the clientId and clientSecret for a quick start.
Do you have any client libraries for these APIs?
We don't provide API client libraries, but you can generate client libraries in so many different languages using http://editor.swagger.io/ and the below JSON API Description. Simply go to http://editor.swagger.io/, copy paste the below JSON into the editor, click on Generate Client and select the language.
Where can I find help and support?
For any help, doubts, suggestions, etc. Please get in touch with us at hello@jdoodle.com
Last updated