Codemore API documentation

Codemore API endpoints description.

Problems

Problems | Create a problem.

post
/problems

Request Body

Field Type Description
title   String

Problem title.

statement   String

Problem statement.

input   String

Input taking instructions for the problem.

output   String

Output printing instructions for the problem.

sampleTestCases   Object

Sample Testcases for the problem.

sampleTestCases.count   Number

Sample Testcase count.

sampleTestCases.input   String

Sample Testcase input.

sampleTestCases.output   String

Sample Testcase output.

testCases   Object

Main Testcases for the problem.

testCases.count   Number

Main Testcase count.

testCases.input   String

Main Testcase input.

testCases.output   String

Main Testcase output.

Success 200

Field Type Description
problem Object

Newly created problem.

  _id String

Problem id.

  title String

Problem title.

  statement String

Problem statement.

  input String

Input taking instructions for the problem.

  output String

Output printing instructions for the problem.

  sampleTestCases Object

Sample Testcases for the problem.

    count Number

Sample Testcase count.

    input String

Sample Testcase input.

    output String

Sample Testcase output.

  testCases Object

Main Testcases for the problem.

    count Number

Main Testcase count.

    input String

Main Testcase input.

    output String

Main Testcase output.

HTTP/1.1 200 OK
{
         "_id": "example_id- 343adresraedfe4re",
         "title": "Problem title",
         "statement": "Problem statement",
         "input": "Input instructions",
         "output": "Output instructions",
         "sampleTestCases": {
            "count": 2,
            "input": "example input",
            "output" : "example output"
         },
         "testCases": {
            "count": 2,
            "input": "example input",
            "output" : "example output"
         }
     }

Error 4xx

Name Description
CreateProblemError

Fields are missing or Invalid test case format or Internal Server Error.

Problems | Get a problem.

get
/problems/:id

Parameter

Field Type Description
id String

Problem id.

Success 200

Field Type Description
problem Object

Problem with given id.

  _id String

Problem id.

  title String

Problem title.

  statement String

Problem statement.

  input String

Input taking instructions for the problem.

  output String

Output printing instructions for the problem.

  sampleTestCases Object

Sample Testcases for the problem.

    count Number

Sample Testcase count.

    input String

Sample Testcase input.

    output String

Sample Testcase output.

  testCases Object

Main Testcases for the problem.

    count Number

Main Testcase count.

    input String

Main Testcase input.

    output String

Main Testcase output.

HTTP/1.1 200 OK
{
         "_id": "example_id- 343adresraedfe4re",
         "title": "Problem title",
         "statement": "Problem statement",
         "input": "Input instructions",
         "output": "Output instructions",
         "sampleTestCases": {
            "count": 2,
            "input": "example input",
            "output" : "example output"
         },
         "testCases": {
            "count": 2,
            "input": "example input",
            "output" : "example output"
         }
     }

Error 4xx

Name Description
ProblemError

Problem doesn't exist or Internal Server Error.

Problems | Get all problems.

get
/problems

Parameter

Field Type Description
page optional Number

Default value: 1

size optional Number

Default value: 50

Success 200

Field Type Description
totalProblems Number

Total available problems in the database.

problems Object[]

List of problems on given page.

  _id String

Problem id.

  title String

Problem title.

  statement String

Problem statement.

  input String

Input taking instructions for the problem.

  output String

Output printing instructions for the problem.

  sampleTestCases Object

Sample Testcases for the problem.

    count Number

Sample Testcase count.

    input String

Sample Testcase input.

    output String

Sample Testcase output.

  testCases Object

Main Testcases for the problem.

    count Number

Main Testcase count.

    input String

Main Testcase input.

    output String

Main Testcase output.

HTTP/1.1 200 OK
{
  "totalProblems": 200,
  "problems": [
     {
         "_id": "example_id- 343adresraedfe4re",
         "title": "Problem title",
         "statement": "Problem statement",
         "input": "Input instructions",
         "output": "Output instructions",
         "sampleTestCases": {
            "count": 2,
            "input": "example input",
            "output" : "example output"
         },
         "testCases": {
            "count": 2,
            "input": "example input",
            "output" : "example output"
         }
     }
     .
     .
     .
   ]
}

Error 4xx

Name Description
ProblemsError

Problems not available or Internal Server Error.

Problems | Run code

post
/problems/run

Request Body

Field Type Description
srcCode   String

Source code.

langID   Number

id for language used to code.

userInput   String

Input provided by user.

Success 200

Field Type Description
response Object

Judge0 api response.

Error 4xx

Name Description
RunCodeError

No data is provided or Rapid-API limit exceeded or Internal Server Error.

Problems | Submit solution

put
/problems/:id/submit

Parameter

Field Type Description
id String

Problem id.

Request Body

Field Type Description
srcCode   String

Source code.

porblemTitle   String

Title of given problem.

language   Object

Language used for solution.

language.id   Number

Language id.

language.name   String

Language name.

Success 200

Field Type Description
response Object

Judge0 api response.

Error 4xx

Name Description
SubmitProblemError

No data is provided or Rapid-API limit exceeded or Internal Server Error.

Problems | Update a problem.

put
/problems/:id

Parameter

Field Type Description
id String

Problem id.

Request Body

Field Type Description
title   optional String

Problem title.

statement   optional String

Problem statement.

input   optional String

Input taking instructions for the problem.

output   optional String

Output printing instructions for the problem.

testCases   optional Object

Main Testcases for the problem.

testCases.count   Number

Main Testcase count.

testCases.input   String

Main Testcase input.

testCases.output   String

Main Testcase output.

Success 200

Field Type Description
problem Object

Updated problem.

  _id String

Problem id.

  title String

Problem title.

  statement String

Problem statement.

  input String

Input taking instructions for the problem.

  output String

Output printing instructions for the problem.

  sampleTestCases Object

Sample Testcases for the problem.

    count Number

Sample Testcase count.

    input String

Sample Testcase input.

    output String

Sample Testcase output.

  testCases Object

Main Testcases for the problem.

    count Number

Main Testcase count.

    input String

Main Testcase input.

    output String

Main Testcase output.

HTTP/1.1 200 OK
{
         "_id": "example_id- 343adresraedfe4re",
         "title": "Updaed problem title",
         "statement": "Updaed problem statement",
         "input": "Input instructions",
         "output": "Output instructions",
         "sampleTestCases": {
            "count": 2,
            "input": "example input",
            "output" : "example output"
         },
         "testCases": {
            "count": 2,
            "input": "example input",
            "output" : "example output"
         }
     }

Error 4xx

Name Description
UpdateProblemError

No data is provided or Invalid test case format or Internal Server Error.

User

User | Get user submissions.

get
/user/:username/submissions

Parameter

Field Type Description
username String

username of the User.

Success 200

Field Type Description
porblemID String

Problem's id for which submission was made.

problemTitle String

Title of the problem.

languageName String

Language used to submit the solution.

status Object

Submission status.

  id Number

Submission status id.

  description String

Submission status description.

HTTP/1.1 200 OK
{
  "problemID": "example_id",
  "problemTitle": "Find the array element",
  "languageName" : "CPP",
  "status": {
     "id": 3,
     "description": "Accepted"
  }
}

Error 4xx

Name Description
SingInError

Email/password is missing or User doesn't exists with email or Password is invalid.

Generated with apidoc 0.51.1 - Tue Jun 07 2022 19:11:04 GMT+0530 (India Standard Time)