Skip to content

Instantly share code, notes, and snippets.

@tuankiet65
Created April 12, 2019 11:17
Show Gist options
  • Save tuankiet65/1227aa75f48f6e3aaf6d36741b186e86 to your computer and use it in GitHub Desktop.
Save tuankiet65/1227aa75f48f6e3aaf6d36741b186e86 to your computer and use it in GitHub Desktop.
openapi: 3.0.1
info:
title: cms-rest-api
description: REST API for accessing/modifying CMS resources
contact:
name: Ho Tuan Kiet
url: 'https://tuankiet65.moe'
email: tuankiet65@gmail.com
license:
name: GNU General Public License v3
url: 'https://www.gnu.org/licenses/gpl-3.0.en.html'
version: 0.0.1
tags:
- name: admin
description: CMS Admin
- name: contest
description: CMS Contest
paths:
/admin:
get:
tags:
- admin
summary: Retrieve list of CMS admins
responses:
'200':
description: An array of CMS admins
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Admin'
post:
tags:
- admin
summary: Add a new CMS admin
requestBody:
description: Admin object that needs to be added
content:
application/json:
schema:
$ref: '#/components/schemas/Admin'
required: true
responses:
'200':
$ref: '#/components/responses/200'
'/admin/{admin_id}':
get:
tags:
- admin
summary: Retrieve a specific CMS admin
parameters:
- name: admin_id
in: path
description: Admin ID
required: true
schema:
type: integer
responses:
'200':
description: Admin object of the requested user
content:
application/json:
schema:
$ref: '#/components/schemas/Admin'
put:
tags:
- admin
summary: Replace existing admin with a new one
parameters:
- name: admin_id
in: path
description: Admin ID
required: true
schema:
type: integer
requestBody:
description: Admin object to be added
content:
application/json:
schema:
$ref: '#/components/schemas/Admin'
responses:
404:
description: Admin not found
delete:
tags:
- admin
summary: Delete a CMS admin
parameters:
- name: admin_id
in: path
description: Admin ID
required: true
schema:
type: integer
responses:
404:
description: Admin not found
/contest:
get:
tags:
- contest
summary: Retrieve all contests
responses:
200:
description: An array of Contest objects
content:
application/json:
schema:
$ref: '#/components/schemas/Contest'
post:
tags:
- contest
summary: Add new contest
requestBody:
description: Object of type Contest
content:
application/json:
schema:
$ref: '#/components/schemas/Contest'
responses:
200:
$ref: '#/components/responses/200'
/contest/{contest_id}:
get:
tags:
- contest
summary: Retrieve a specific contest
parameters:
- $ref: '#/components/parameters/contest_id'
responses:
200:
description: Contest object
content:
application/json:
schema:
$ref: '#/components/schemas/Contest'
put:
tags:
- contest
summary: Replace existing ontest
parameters:
- $ref: '#/components/parameters/contest_id'
requestBody:
description: Object of type Contest
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Contest'
responses:
404:
description: Contest not found
delete:
tags:
- contest
summary: Delete a contest (and corresponding announcements and participations)
parameters:
- $ref: '#/components/parameters/contest_id'
responses:
404:
description: Content not found
components:
parameters:
contest_id:
name: contest_id
in: path
required: true
description: Contest ID
schema:
type: integer
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
id:
type: integer
schemas:
Admin:
type: object
properties:
id:
type: integer
name:
type: string
username:
type: string
authentication:
type: string
enabled:
type: boolean
permission_all:
type: boolean
permission_messaging:
type: boolean
Contest:
type: object
properties:
id:
type: integer
name:
# Codename
type: string
description:
# Unicode
type: string
allowed_localizations:
type: array
items:
type: string
default: []
languages:
type: array
items:
type: string
enum:
# to be filled
- "C11 / gcc"
- "C++11 / g++"
- Pascal / fpc
default:
- "C11 / gcc"
- "C++11 / g++"
- Pascal / fpc
submissions_download_alllowed:
type: boolean
default: true
allow_questions:
type: boolean
default: true
allow_user_tests:
type: boolean
default: true
block_hidden_participants:
type: boolean
default: false
allow_password_authentication:
type: boolean
default: false
allow_registration:
type: boolean
default: false
ip_restriction:
type: boolean
default: true
ip_autologin:
type: boolean
default: false
token_mode:
type: string
enum:
- TOKEN_MODE_DISABLED
- TOKEN_MODE_FINITE
- TOKEN_MODE_INFINITE
default: TOKEN_MODE_INFINITE
token_max_number:
type: integer
format: int64
token_min_interval:
type: integer
format: int64
token_gen_initial:
type: integer
format: int64
token_gen_number:
type: integer
format: int64
token_gen_interval:
type: integer
format: int64
token_gen_max:
type: integer
format: int64
start:
type: string
format: date-time
stop:
type: string
format: date-time
analysis_enabled:
type: boolean
default: false
analysis_start:
type: string
format: date-time
analysis_stop:
type: string
format: date-time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment