Problems
Endpoints for managing problems
Creates a new problem using the provided data.
Authorizations
Body
namestringRequiredExample:
Name of the problem
Sum of Two Numbers
descriptionstringRequiredExample:
Description of the problem
Calculate the sum of two integers.
inDatastringRequiredExample:
Input data for the problem
1
outDatastringRequiredExample:
Expected output data for the problem
3
testsstringRequiredExample:
Test cases for the problem (JSON)
{"in":"1","out":"3"}
examplesstringRequiredExample:
Example cases for the problem (JSON)
{"in":"1","out":"3"}
Responses
200
OK
*/*
401
Unauthorized
*/*
403
Forbidden
*/*
500
Internal Server Error
*/*
post
POST /api/problems HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 164
{
"name": "Sum of Two Numbers",
"description": "Calculate the sum of two integers.",
"inData": 1,
"outData": 3,
"tests": {
"in": "1",
"out": "3"
},
"examples": {
"in": "1",
"out": "3"
}
}
{
"id": 1,
"name": "Sum of Two Numbers",
"description": "Calculate the sum of two integers.",
"inData": 1,
"outData": 3,
"examples": "Input: 1 2, Output: 3",
"public": true
}
Retrieves a problem by its ID. Required admin role
Authorizations
Path parameters
idinteger · int64Required
Responses
200
OK
*/*
401
Unauthorized
*/*
403
Forbidden
*/*
500
Internal Server Error
*/*
get
GET /api/problems/{id} HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Accept: */*
{
"id": 1,
"name": "Sum of Two Numbers",
"description": "Calculate the sum of two integers.",
"inData": 1,
"outData": 3,
"examples": "Input: 1 2, Output: 3",
"public": true
}
Applies partial updates to a problem by its ID.
Authorizations
Path parameters
idinteger · int64Required
Body
anyOptional
Responses
200
OK
*/*
401
Unauthorized
*/*
403
Forbidden
*/*
500
Internal Server Error
*/*
patch
PATCH /api/problems/{id} HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
{
"id": 1,
"name": "text",
"description": "text",
"inData": "text",
"outData": "text",
"tests": "text",
"examples": "text"
}
Retrieves a problem by its ID with admin-level access. Required admin role
Authorizations
Path parameters
idinteger · int64Required
Responses
200
OK
*/*
401
Unauthorized
*/*
403
Forbidden
*/*
500
Internal Server Error
*/*
get
GET /api/problems/{id}/admin HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Accept: */*
{
"id": 1,
"name": "text",
"description": "text",
"inData": "text",
"outData": "text",
"tests": "text",
"examples": "text"
}
Was this helpful?