The REST API CodeJudge is publicly available for you to use. The API is located at https://app.codejudge.net/api. If you use it for any critical systems, please send us an e-mail, so we can notify you in case of changes.
The API is using JWT token-based authentication. The JWT token should be sent in the authorization Bearer header of each request to the API.
To obtain a JWT, one must first generate an API token through the web client. The differences between JWT and API tokens are:
We are using API tokens to obtain JWT's to avoid the user having to use password authentication when accessing the API.
An API token can be generated through the web client by navigating to the "API tokens" page from the user menu (opened by clicking on the user name in the upper right corner).
Using the newly generated API token a JWT can now be obtained through the /auth/token endpoint (which is the only endpoint not requiring an Authorization header with a valid JWT).
Here is how it could be done in python:
import requests
import json
api_url = "https://app.codejudge.net/api/"
api_token = "token" # insert generated API token from CodeJudge
model = { "grantType": "refresh_token", "refreshToken": api_token }
jwtReq = requests.post(api_url + "auth/token", data=json.dumps(model))
jwtReq.raise_for_status()
jwt = jwtReq.json()["accessToken"]
We can now authenticate to the API, e.g. to get the submission with id=100:
# ... continued
submission_id = 100
headers = {"Authorization": "Bearer " + jwt}
req = requests.get(api_url + "submissions/" + str(submission_id), headers=headers)
req.raise_for_status()
submission = req.json()
print(submission)
Http Method
Path
Description
Post
/api/auth/token
Generate access token for API
Post
/api/auth/api-token
Delete
/api/auth/api-token/id
Get
/api/auth/api-tokens
Http Method
Path
Description
Get
/api/courses
Get
/api/courses/id
Put
/api/courses/id
Get
/api/courses/by-url/courseUrl
Get
/api/courses/id/user-statistics
Get
/api/courses/id/statistics
Get
/api/courses/id/languages
Post
/api/courses/id/synchronize-cas
Post
/api/courses/id/report
Post
/api/courses/id/sync
Get
/api/courses/id/exported-zip
Http Method
Path
Description
Get
/api/exercise-collections
Post
/api/exercise-collections
Get
/api/exercise-collections/id
Put
/api/exercise-collections/id
Delete
/api/exercise-collections/id
Post
/api/exercise-collections/id/move
Post
/api/exercise-collections/id/sync
Get
/api/exercise-collections/id/exported-zip
Get
/api/exercise-collections/submissions
Get
/api/exercise-collections/id/submissions
Get
/api/exercise-collections/id/submissions/userId
Post
/api/exercise-collections/id/open/userId
Get
/api/exercise-collections/id/invitations/userId
Post
/api/exercise-collections/id/invite-user/userId
Post
/api/exercise-collections/id/accept-invitation/ownerUserId
Post
/api/exercise-collections/id/reject-invitation/ownerUserId
Post
/api/exercise-collections/id/remove-group-member/userId
Post
/api/exercise-collections/id/leave-group
Put
/api/exercise-collections/id/groups/ownerUserId/comment
Put
/api/exercise-collections/id/groups/ownerUserId/feedback
Post
/api/exercise-collections/id/activate-passive-submissions
Get
/api/exercise-collections/id/download-submissions
Http Method
Path
Description
Get
/api/exercises
Post
/api/exercises
Get
/api/exercises/results
Get
/api/exercises/id
Put
/api/exercises/id
Delete
/api/exercises/id
Get
/api/exercises/id/solutions
Get
/api/exercises/id/attachment/filename
Get
/api/exercises/id/sample-test
Get
/api/exercises/id/data-file
Get
/api/exercises/id/data-files
Get
/api/exercises/id/stats
Get
/api/exercises/id/exported-zip
Post
/api/exercises/id/move
Post
/api/exercises/id/sync
Get
/api/exercises/id/plagiarism-groups
Post
/api/exercises/id/plagiarism-report
Http Method
Path
Description
Get
/api/faq-entries
Post
/api/faq-entries
Get
/api/faq-entries/id
Put
/api/faq-entries/id
Delete
/api/faq-entries/id
Http Method
Path
Description
Get
/api/pages
Post
/api/pages
Get
/api/pages/id
Put
/api/pages/id
Delete
/api/pages/id
Http Method
Path
Description
Get
/api/submissions
Post
/api/submissions
Get
/api/submissions/id
Get
/api/submissions/id/file-links
Get
/api/submissions/id/file/fileId
Get
/api/submissions/id/download-files
Post
/api/submissions/id/mark-not-late
Post
/api/submissions/id/regrade/testGroupId
Get
/api/submissions/id/plagiarism-group
Get
/api/submissions/id/plagiarism-comparison/otherId
Http Method
Path
Description
Get
/api/templates
Post
/api/templates
Get
/api/templates/id
Put
/api/templates/id
Delete
/api/templates/id
Post
/api/templates/id/copy
Get
/api/templates/id/data-file
Get
/api/templates/id/data-files
Get
/api/templates/id/exported-zip
Http Method
Path
Description
Get
/api/test-group-runs
Get
/api/test-group-runs/id/data
Get
/api/test-group-runs/id/debug-data
Get
/api/test-group-runs/id/all-data
Http Method
Path
Description
Get
/api/test-groups
Post
/api/test-groups
Get
/api/test-groups/id
Put
/api/test-groups/id
Delete
/api/test-groups/id
Get
/api/test-groups/id/generation-data-file
Get
/api/test-groups/id/generation-data
Post
/api/test-groups/id/generate
Get
/api/test-groups/id/data-file
Get
/api/test-groups/id/data-files
Get
/api/test-groups/id/generated-files
Http Method
Path
Description
Get
/api/test-runs/id
Http Method
Path
Description
Get
/api/tests
Get
/api/tests/testGroupId/name
Http Method
Path
Description
Get
/api/users/auth-user
Get
/api/users/id
Put
/api/users/id
Get
/api/users/for-course/courseId
Get
/api/users/id/for-course/courseId
Post
/api/users
Name
Type
Description
token
Type: string
expires
Type: date
lastUsed
Type: date
Name
Type
Description
exerciseCollectionId
Type: integer
exerciseCollectionName
Type: string
Name
Type
Description
id
Type: integer
urlName
Type: string
shortName
Type: string
name
Type: string
useCasLogin
Type: boolean
[Admin Only]
casCourseNames
Type: string
[Admin Only]
casLastSynchronized
Type: date
[Admin Only]
expires
Type: date
culture
Type: string
showExercises
Type: boolean
showAssignments
Type: boolean
showSolvedBy
Type: boolean
Name
Type
Description
Name
Type
Description
userId
Type: integer
Type: string
[Admin Only]
name
Type: string
studentId
Type: string
courseId
Type: integer
tag
Type: string
[Admin Only]
Name
Type
Description
totalSubmissions
Type: integer
Name
Type
Description
name
Type: string
content
Type: string
isTruncated
Type: boolean
Name
Type
Description
id
Type: integer
courseId
Type: integer
name
Type: string
created
Type: date
[Admin Only]
visibleFrom
Type: date
[Admin Only]
description
Type: string
groupsAllowed
Type: boolean
commentsAllowed
Type: boolean
visibleToAuthors
Type: boolean
[Admin Only]
due
Type: date
timeLimit
Type: integer
postSubmissionsAllowed
Type: boolean
Name
Type
Description
exerciseCollectionId
Type: integer
ownerUserId
Type: integer
comment
Type: string
feedback
Type: string
startTime
Type: date
Name
Type
Description
id
Type: integer
exerciseCollectionId
Type: integer
name
Type: string
description
Type: string
customSuggestedSolution
Type: string
[Admin Only]
useCustomSuggestedSolution
Type: boolean
[Admin Only]
hasSuggestedSolution
Type: boolean
createdDateTime
Type: date
[Admin Only]
priority
Type: integer
templateId
Type: integer
[Admin Only]
Name
Type
Description
submissionCount
Type: integer
Name
Type
Description
exerciseId
Type: integer
exerciseName
Type: string
submissionCount
Type: integer
averageSubmissionCount
Type: number
solvedCount
Type: integer
attemptedCount
Type: integer
Name
Type
Description
Name
Type
Description
id
Type: integer
courseId
Type: integer
title
Type: string
description
Type: string
priority
Type: integer
created
Type: date
[Admin Only]
lastModified
Type: date
[Admin Only]
Name
Type
Description
name
Type: string
contentKey
Type: string
uploadContent
Type: string
Name
Type
Description
studentId
Type: string
userId
Type: integer
name
Type: string
accepted
Type: boolean
Name
Type
Description
groupOwnerId
Type: integer
groupOwnerName
Type: string
Name
Type
Description
name
Type: string
mainExtension
Type: string
version
Type: string
Name
Type
Description
id
Type: integer
courseId
Type: integer
title
Type: string
menuName
Type: string
urlName
Type: string
content
Type: string
requiresLogin
Type: boolean
[Admin Only]
requiresAdmin
Type: boolean
[Admin Only]
Name
Type
Description
score
Type: number
Name
Type
Description
submissionText
Type: string
otherSubmissionText
Type: string
Name
Type
Description
highestScore
Type: number
Name
Type
Description
from
Type: integer
to
Type: integer
matchesFrom
Type: integer
matchesTo
Type: integer
Name
Type
Description
ids
Type: array of integer
includeInstructors
Type: boolean
includeLateSubmissions
Type: boolean
Name
Type
Description
grantType
Type: string
username
Type: string
password
Type: string
refreshToken
Type: string
Name
Type
Description
accessToken
Type: string
refreshToken
Type: string
Name
Type
Description
length
Type: integer
column
Type: integer
line
Type: integer
Name
Type
Description
comment
Type: string
Name
Type
Description
feedback
Type: string
Name
Type
Description
name
Type: string
id
Type: integer
Name
Type
Description
id
Type: integer
submissionId
Type: integer
name
Type: string
content
Type: string
Name
Type
Description
id
Type: integer
dateTime
Type: date
userId
Type: integer
userDisplayName
Type: string
uploadedByUserId
Type: integer
uploadedByUserDisplayName
Type: string
exerciseId
Type: integer
exerciseName
Type: string
isPassive
Type: boolean
comment
Type: string
score
Type: number
Name
Type
Description
date
Type: date
count
Type: integer
Name
Type
Description
id
Type: integer
userId
Type: integer
ignoreDue
Type: boolean
comment
Type: string
Name
Type
Description
filesKey
Type: string
Name
Type
Description
changelog
Type: string
filesKey
Type: string
syncCompleted
Type: boolean
errorOccured
Type: boolean
Name
Type
Description
name
Type: string
Name
Type
Description
id
Type: integer
courseId
Type: integer
name
Type: string
created
Type: date
isInUse
Type: boolean
Name
Type
Description
id
Type: integer
exerciseId
Type: integer
name
Type: string
created
Type: date
[Admin Only]
priority
Type: integer
onTestGroupFailureGoto
Type: integer
[Admin Only]
runManually
Type: boolean
[Admin Only]
Name
Type
Description
id
Type: integer
submissionId
Type: integer
testGroupId
Type: integer
grader
Type: string
[Admin Only]
created
Type: date
finished
Type: date
gradingStarted
Type: date
[Admin Only]
executionTime
Type: integer
[Admin Only]
priority
Type: integer
[Admin Only]
score
Type: number
log
Type: string
[Admin Only]
compilerOut
Type: string
Name
Type
Description
testGroupId
Type: integer
name
Type: string
hint
Type: string
Name
Type
Description
id
Type: integer
testGroupRunId
Type: integer
name
Type: string
cpuTime
Type: integer
wallTime
Type: integer
memory
Type: integer
judgeOutput
Type: string
judgeMachine
Type: string
score
Type: number
hint
Type: string
Name
Type
Description
name
Type: string
content
Type: string
Name
Type
Description
id
Type: integer
Type: string
name
Type: string
isAdministrator
Type: boolean
studentId
Type: string
assignment | exerciseGroup
group | language | result | submissions | solvedTests | score | totalRunningTime | submissionId | submissionTime | signature | tests
noGeneration | generate | generating | failed | succeeded
java8 | cpp | c | python | cSharp | matlab | r | bash | fSharp | lua | prolog | rust | pascal | coq | haskell | elixir | go | hdl | javaScript | typeScript | java | scala | fSharpInteractive | python27 | java6 | cpp11 | cpp1z
break | continue | goto
content | html | code | split | plot
afterSolved | always | never
compilationError | testsFailed | succeeded | partlySucceeded
created | processing | completed | systemError | inQueue | exerciseError
latestSubmission | bestSubmission
course | exerciseCollection | exercise
result | score | time
full | resultAndJudgeOutput | onlyResult | hidden
result | score | solvedTests | tests
compileError | testFailed | succeeded
created | inQueue | processing | completed | systemError | exerciseError | cancelled | waiting
succeeded | nonZeroExitCode | signaled | runtimeLimit | cpuTimeLimit | wrongAnswer
user | author | administrator | noRole