API Documentation

Integrate with our Online Code Editor API

GET /api/editor

This endpoint returns the current state of the code editor including HTML, CSS, and JavaScript.

{
  "html": "

Hello World

", "css": "p { color: red; }", "javascript": "console.log('Hello');" }

POST /api/editor

This endpoint saves the user's code (HTML, CSS, and JavaScript) for future use.

{
  "html": "

New Code

", "css": "p { color: blue; }", "javascript": "console.log('Updated Code');" }

GET /api/editor/{id}

Fetch a saved code snippet by its unique identifier.

{
  "id": "12345",
  "html": "
Hello, User!
", "css": "div { color: green; }", "javascript": "console.log('Fetched Saved Code');" }

DELETE /api/editor/{id}

Delete a specific saved code snippet by its unique identifier.

{
  "message": "Code snippet successfully deleted"
}
                

PUT /api/editor/{id}

Update an existing saved code snippet by providing the new HTML, CSS, and JavaScript.

{
  "id": "12345",
  "html": "

Updated Code

", "css": "p { color: orange; }", "javascript": "console.log('Code Updated');" }

GET /api/editor/list

Retrieve a list of all saved code snippets.

[
  {
    "id": "12345",
    "html": "

First Code

", "css": "p { color: blue; }", "javascript": "console.log('Code 1');" }, { "id": "67890", "html": "

Second Code

", "css": "p { color: green; }", "javascript": "console.log('Code 2');" } ]