Skip to content

Problem

Siyuan Zhang | 张豆 edited this page Oct 11, 2019 · 1 revision

Get All Problems

HTTP Request

GET /api/v1/problems

URL Parameters

Parameter Default Description
page 0
size 10

Query Parameters

Parameter Default Description
title null fuzzy query
tags null String, separate tagId by commas

Example

GET /api/v1/problems?page=1&size=5&title=test&tags=37,42

Response

[
    {
        "id": 47,
        "authorId": 20,
        "authorName": "kastnerorz",
        "title": "test4",
        "description": "test",
        "timeLimit": 10,
        "ramLimit": 128,
        "difficulty": "HIGH",
        "enabled": true,
        "tagList": [
            {
                "id": 37,
                "name": "test"
            }
        ],
        "inputDesc": "test",
        "outputDesc": "test",
        "sampleIOList": [
            {
                "id": 48,
                "input": "test",
                "output": "test"
            },
            {
                "id": 49,
                "input": "test1",
                "output": "test1"
            }
        ],
        "specialJudged": false,
        "testData": "test",
        "hint": "",
        "source": "",
        "averageAcceptTime": 0,
        "acceptCount": 0,
        "submitCount": 0,
        "acceptRate": 0,
        "createDate": "2018-08-26T16:28:51",
        "lastUsedDate": "2018-08-26T16:28:51"
    },
    {
    	"...":"..."
    }
]

Get a Specific Problem

HTTP Request

GET /api/v1/problems/:id

Response

{
    "...":"..."
}

Create a Problem

HTTP Request

POST /api/v1/problems

Request Parameters

The parameter which default is "null" must be provided

Parameter Default Description
authorId
title Unique
description
timeLimit
ramLimit
difficulty HIGH / MEDIUM / LOW
enabled true
email
tagList List
inputDesc
outputDesc Unique
sampleIOList List
sampleIOList.input
sampleIOList.output
specialJudged false
testData file upload url
hint " "
source " "

Response

It will return the problem just created.

{
  "...":"..."
}

Update a Specific Problem

HTTP Request

PUT /api/v1/problems/:id

Request Parameters

Same as the previous one except the HTTP verb

Parameter Default Description
authorId
title Unique
description
timeLimit
ramLimit
difficulty HIGH / MEDIUM / LOW
enabled true
email
tagList List
inputDesc
outputDesc Unique
sampleIOList List
sampleIOList.input
sampleIOList.output
specialJudged false
testData file upload url
hint " "
source " "

Response

It will return the problem just updated.

{
	"...":"..."
}

Delete a Specific Problem

HTTP Request

DELETE /api/v1/problems/:id

Response

{
    "...":"..."
}