CodeX

FREEMIUM
By Jaagrav Seal | Updated il y a 16 jours | Other
Popularity

0.3 / 10

Latency

332ms

Service Level

0%

Health Check

N/A

README

CodeX API

Introducing the new CodeX API

Here’s how you can execute code in various languages on your own website for free (no, there’s no fucking catch, it’s literally free),

Execute Code and fetch output

POST /

This endpoint allows you to execute your script and fetch output results.

What are the Input Parameters for execute api call?

Parameter Description
“code” Should contain the script that needs to be executed
“language” Language that the script is written in for example: java, cpp, etc. (Check language as a payload down below in next question)
“input” In case the script requires any kind of input for execution, leave empty if no input required

What are the languages that are supported for execution?

Whichever language you might mention in the language field, it would be automatically executed with the latest version of it’s compiler.

Languages Language as a payload
Java java
Python py
C++ cpp
C c

More coming very soon!

NodeJS Example to Execute API Call?

const axios = require("axios");

const encodedParams = new URLSearchParams();
encodedParams.append("code", "public class HelloWorld {  public static void main(String args[]) { System.out.println(\"Hello World!\"); } }");
encodedParams.append("language", "java");

const options = {
  method: 'POST',
  url: 'https://codex7.p.rapidapi.com/',
  headers: {
    'content-type': 'application/x-www-form-urlencoded',
    'X-RapidAPI-Host': 'codex7.p.rapidapi.com',
    'X-RapidAPI-Key': 'fcc2d6c6b3msh404adbe533c36f5p148528jsn4a93557ee62f'
  },
   encodedParams
};

axios.request(options).then(function (response) {
	console.log(response.data);
}).catch(function (error) {
	console.error(error);
});

Sample Output

The output is a JSON object comprising only one parameter that is the output.

{
  "success": true,
  "timestamp": "2022-05-26T19:59:08.014Z",
  "output": "Hello\nWorld\n",
  "language": "java",
  "version": "11.0.15"
}

> Since a lot of people had issues with executing the previous API from backend or serverless function, unlike the previous version of the API, this version of the API won’t throw any Cross Origin errors so you can use this from the front end without any worries. Thank me later 😉

GET /list

This endpoint allows you to list all languages supported and their versions.

[
  {
    "language": "java",
    "compilerVersion": "11.0.15"
  },
  {
    "language": "cpp",
    "compilerVersion": "11.2.0"
  },
  {
    "language": "py",
    "compilerVersion": "3.7.7"
  },
  {
    "language": "c",
    "compilerVersion": "11.2.0"
  }
]

Show your subject by starring the project on github, also check out the source code for the API by visiting the CodeX-API repo. Do check out CodeX’s website where you can compile and save code for free, codex.jaagrav.in.

Follow me on Github.
Visit my portfolio website on jaagrav.in.

Happy hacking!

Followers: 1
Resources:
Product Website Terms of use
API Creator:
Rapid account: Jaagrav Seal
Jaagrav Seal
jaagravseal03
Log In to Rate API
Rating: 5 - Votes: 1