Compiler API FAQ

What this service is?

JDoodle Compiler is an online API service to compile and execute Programs online via APIs, it supports Java, C/C++, PHP, Perl, Python, Ruby and many more languages.

What type of API it is?

It is a JSON based Rest API.

Can I call your API directly from a web page?

This APIs are meant for server to server call and protected with client ID and Client Secret, if you make call directly from web page then you have to expose your personal client ID and Secret in the page which is not secure and we request you not to do that. Best way is to direct the request from your webpage to your own server and call JDoodle API from your server.

Is web socket supported?

Web socket is not supported in our public offering. Available in unlimited/custom plans.

What is the request endpoint for compiler api?

https://api.jdoodle.com/v1/execute (only POST method supported with Content-Type: application/json)

What is the request endpoint to check my today's usage?

https://api.jdoodle.com/v1/credit-spent (only POST method supported with Content-Type: application/json)

What subscription options available?

We have got multiple plans including a Free plan, please refer compiler-api home page for current Plans.

Is plan costs are in USD?

All the cost mentioned is in USD.

Can I change from one plan to another plan?

Yes. if you are upgrading from lower volume plan to upper volume plan, your change will be immediate. if you are moving from upper volume plan to lower volume plan, your change will be effective from end of your current billing period

What is a billing period and when my credit card charged?

When you subscribe to a paid plan first time, you are paying for the plan and your billing period starts from that date, your credit card will be charged every month on that day. For example, if you subscribe for a paid plan on 5th November, your billing period is 5th of every month, and you will be charged on 5th of every month.

How cost calculated when I move from lower volume plan to upper volume plan and when I will be charged (upgrade)?

You are always charged only on your billing date, that is at the end of current billing period. if you move to upper volume plan, the cost is calculated on prorate basis and the additional cost for the current billing period will be included in the next payment. For example, if your billing period starts on 1st April and your current plan is $10 per Month, if you are moving to $20 plan on 16th of April. Your next bill will be calculated approximately like = (usage on current plan $10 on prorate from 1st to 15th) $5 + (usage on new plan $20 for 16th to 30th on prorate basis) $10 + (next billing period cost for 1st May to 31st May) $20 - (Amount you have already paid for 1st to 30th April) $10 = $25.

How cost calculated when I move from upper volume plan to lower volume plan (downgrade)?

When you are moving from upper volume plan to lower lower volume plan, the change is effective only from start of your next billing period, so you will be charged for new plan from start of new billing period. you can continue use your current plan until the end of current billing period, no refund provided.

What happens when I cancel my subscription?

if you are on Free plan, the cancellation will be processed immediately. if you are on Paid plan, your subscription will be cancelled at the end of your current billing period, you can use your plan until end of current billing period. no refund provided.

Can I reactivate my subscription?

If you cancelled, you can reactivate any time until the end of your current billing period. if end of billing period reached, you have to subscribe again.

Is My Credit Card Details safe?

We use Stripe for all Credit Card processing, we are not storing or handling your Credit Card details in our systems.

What are the Input Parameters for execute api call?

Parameter

Description

clientId

Client ID for your subscription

clientSecret

Client Secret for your subscription

script

program to compile and execute

stdin

StdIn

language

language of the script (refer the supported language list below)

versionIndex

version of the language to be used (refere the supportoed languages and versions in list below)

What are the Output Parameters for 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

What are the Output Parameters for execute api call when the execution failed?

Parameter

Description

error

error message

statusCode

Status Code of the result

What are the Input Parameters for "credit-spent" api call?

Parameter

Description

clientId

Client ID for your subscription

clientSecret

Client Secret for your subscription

What are the Output Parameters for "credit-spent" api call when the execution is successful?

Parameter

Description

used

No of credits used today

What are the Output Parameters for "credit-spent" api call when the execution failed?

Parameter

Description

error

error message

statusCode

Status Code of the result

What languages and versions supported?

Language (not passed in request)

Language Code (passed in request)

Version (not passed in request)

VersionIndex (this is what passed in request)

Java

java

JDK 1.8.0_66

0

JDK 9.0.1

1

JDK 10.0.1

2

C

c

GCC 5.3.0

0

Zapcc 5.0.0

1

GCC 7.2.0

2

GCC 8.1.0

3

C-99

c99

GCC 5.3.0

0

GCC 7.2.0

1

GCC 8.1.0

2

C++

cpp

GCC 5.3.0

0

Zapcc 5.0.0

1

GCC 7.2.0

2

GCC 8.1.0

3

C++ 14

cpp14

g++ 14 GCC 5.3.0

0

g++ 14 GCC 7.2.0

1

g++ 14 GCC 8.1.0

2

PHP

php

5.6.16

0

7.1.11

1

7.2.5

2

Perl

perl

5.22.0

0

5.26.1

1

5.26.2

2

Python 2

python2

2.7.11

0

2.7.15

1

Python 3

python3

3.5.1

0

3.6.3

1

3.6.5

2

Ruby

ruby

2.2.4

0

2.4.2p198

1

2.5.1p57

2

GO Lang

go

1.5.2

0

1.9.2

1

1.10.2

2

Scala

scala

2.12.0

0

2.12.4

1

2.12.5

2

Bash Shell

bash

4.3.42

0

4.4.12

1

4.4.19

2

SQL

sql

SQLite 3.9.2

0

SQLite 3.21.0

1

SQLite 3.23.1

2

Pascal

pascal

fpc 3.0.0

0

fpc-3.0.2

1

fpc-3.0.4

2

C#

csharp

mono 4.2.2

0

mono 5.0.0

1

mono 5.10.1

2

VB.Net

vbn

mono 4.0.1

0

mono 4.6

1

mono 5.10.1

2

Haskell

haskell

ghc 7.10.3

0

ghc 8.2.1

1

ghc 8.2.2

2

Objective C

objc

GCC 5.3.0

0

GCC 7.2.0

1

GCC 8.1.0

2

Swift

swift

2.2

0

3.1.1

1

4.1

2

Groovy

groovy

2.4.6 JVM: 1.7.0_99

0

2.4.12 JVM: 9.0.1

1

2.4.15 JVM: 10.0.1

2

Fortran

fortran

GNU 5.3.0

0

GNU 7.2.0

1

GNU 8.1.0

2

Brainf**k

brainfuck

bfc-0.1

0

Lua

lua

5.3.2

0

5.3.4

1

TCL

tcl

8.6

0

8.6.7

1

8.6.8

2

Hack

hack

HipHop VM 3.13.0

0

RUST

rust

1.10.0

0

1.21.0

1

1.25.0

2

D

d

DMD64 D Compiler v2.071.1

0

Ada

ada

GNATMAKE 6.1.1

0

GNATMAKE 7.2.0

1

GNATMAKE 8.1.0

2

R Language

r

3.3.1

0

3.4.2

1

3.5.0

2

FREE BASIC

freebasic

1.05.0

0

VERILOG

verilog

10.1

0

10.2

1

COBOL

cobol

GNU COBOL 2.0.0

0

GNU COBOL 2.2.0

1

Dart

dart

1.18.0

0

1.24.2

1

1.24.3

2

YaBasic

yabasic

2.769

0

Clojure

clojure

1.8.0

0

1.9.0

1

NodeJS

nodejs

6.3.1

0

9.2.0

1

10.1.0

2

Scheme

scheme

Gauche 0.9.4

0

Gauche 0.9.5

1

Forth

forth

gforth 0.7.3

0

Prolog

prolog

GNU Prolog 1.4.4

0

Octave

octave

GNU 4.0.0

0

GNU 4.2.1

1

GNU 4.4.0

2

CoffeeScript

coffeescript

1.11.1

0

2.0.0

1

2.3.0

2

Icon

icon

9.4.3

0

F#

fsharp

4.1

0

Assembler - NASM

nasm

2.11.08

0

2.13.01

1

2.13.03

2

Assembler - GCC

gccasm

GCC 6.2.1

0

GCC 8.1.0

1

Intercal

intercal

0.30

0

Nemerle

nemerle

1.2.0.507

0

Ocaml

ocaml

4.03.0

0

Unlambda

unlambda

0.1.3

0

Picolisp

picolisp

3.1.11.1

0

17.11.14

1

18.5.11

2

SpiderMonkey

spidermonkey

38

0

45.0.2

1

Rhino JS

rhino

1.7.7.1

0

BC

bc

1.06.95

0

1.07.1

1

CLISP

clisp

GNU CLISP 2.49 - GNU C 5.2.0

0

GNU CLISP 2.49 - GNU C 6.2.1

1

GNU CLISP 2.49.93 - GNU 8.1.0

2

Elixir

elixir

1.3.4

0

1.5.2

1

1.6.4

2

Factor

factor

8.25

0

8.28

1

8.29

2

Falcon

falcon

0.9.6.8 (Chimera)

0

Fantom

fantom

1.0.69

0

Nim

nim

0.15.0

0

0.17.2

1

0.18.0

2

Pike

pike

v8.0

0

SmallTalk

smalltalk

GNU SmallTalk 3.2.92

0

OZ Mozart

mozart

2.0.0 (OZ 3)

0

LOLCODE

lolcode

0.10.5

0

Racket

racket

6.11

0

6.12

1

Kotlin

kotlin

1.1.51 (JRE 9.0.1+11)

0

1.2.40 (JRE 10.0.1)

1

Whitespace

whitespace

0.3

0

Java Example for Execute API Call?

Below is a quick and dirty Java example, but please use your favorite rest API client and JSON Java libraries for clean code and for production use.

package com.jdoodle;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class APITest {
public static void main(String args[]) {
String clientId = "YourClientID"; //Replace with your client ID
String clientSecret = "YourClientSecret"; //Replace with your client Secret
String script = "";
String language = "php";
String versionIndex = "0";
try {
URL url = new URL("https://api.jdoodle.com/v1/execute");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
String input = "{\"clientId\": \"" + clientId + "\",\"clientSecret\":\"" + clientSecret + "\",\"script\":\"" + script +
"\",\"language\":\"" + language + "\",\"versionIndex\":\"" + versionIndex + "\"} ";
System.out.println(input);
OutputStream outputStream = connection.getOutputStream();
outputStream.write(input.getBytes());
outputStream.flush();
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
throw new RuntimeException("Please check your inputs : HTTP error code : "+ connection.getResponseCode());
}
BufferedReader bufferedReader;
bufferedReader = new BufferedReader(new InputStreamReader(
(connection.getInputStream())));
String output;
System.out.println("Output from JDoodle .... \n");
while ((output = bufferedReader.readLine()) != null) {
System.out.println(output);
}
connection.disconnect();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}

NodeJs Example for Execute API Call?

var request = require('request');
var program = {
script : "",
language: "php",
versionIndex: "0",
clientId: "YourClientID",
clientSecret:"YourClientSecret"
};
request({
url: 'https://api.jdoodle.com/v1/execute',
method: "POST",
json: program
},
function (error, response, body) {
console.log('error:', error);
console.log('statusCode:', response && response.statusCode);
console.log('body:', body);
});

Curl Example for execute API Call?

Below is an Curl example (note: may need slight syntax change in windows)

curl -H "Content-Type: application/json; charset=UTF-8" -X POST -d '{"clientId": "YourClientId","clientSecret":"YourClientSecret","script":"","language":"php","versionIndex":"0"}' https://api.jdoodle.com/v1/execute

Curl Example for "credit-spent" API Call?

Below is an Curl example (note: may need slight syntax change in windows)

curl -H "Content-Type: application/json; charset=UTF-8" -X POST -d '{"clientId": "YourClientId","clientSecret":"YourClientSecret"}' https:

Postman Examples?

Do yo have any client Library 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.

{
"swagger": "2.0",
"info": {
"description": "JDoodle Compiler API",
"version": "1.0.0",
"title": "JDoodle Compiler API",
"termsOfService": "https://www.jdoodle.com/terms",
"contact": {
"email": "jdoodle@nutpan.com"
}
},
"host": "api.jdoodle.com",
"basePath": "/v1",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/execute": {
"post": {
"summary": "Execute Program",
"description": "Endpoint to execute code",
"tags": [
"execute"
],
"parameters": [
{
"name": "execute",
"in": "body",
"description": "the body",
"required": true,
"schema": {
"properties": {
"clientId": {
"type": "string"
},
"clientSecret": {
"type": "string"
},
"script": {
"type": "string"
},
"language": {
"type": "string"
},
"versionIndex": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Execution success"
},
"401": {
"description": "Unauthorized"
},
"429": {
"description": "Daily limit reached"
}
}
}
},
"/credit-spent": {
"post": {
"summary": "Credit Spent",
"description": "Endpoint to execute code",
"tags": [
"credit-spent"
],
"parameters": [
{
"name": "credit",
"in": "body",
"description": "the body",
"required": true,
"schema": {
"properties": {
"clientId": {
"type": "string"
},
"clientSecret": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Execution success"
},
"401": {
"description": "Unauthorized"
}
}
}
}
},
"externalDocs": {
"description": "Find out more about JDoodle Compiler API",
"url": "https://www.jdoodle.com/compiler-api"
}
}

Where can I find help and support?

for any help, doubts, suggestions, etc, get in touch with us at jdoodle@nutpan.com