-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswagger.yaml
162 lines (160 loc) · 3.84 KB
/
swagger.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# this is an example of the Uber API
# as a demonstration of an API spec in YAML
swagger: '2.0'
info:
title: Quiz Bowl API
description: API for Quiz Bowl workshop
version: "1.0.0"
# the domain of the service
host: qb.boydgraber.org
# array of all schemes that your API supports
schemes:
- http
# will be prefixed to all paths
basePath: /qb-api/v1
produces:
- application/json
paths:
/questions:
get:
summary: List of questions
description: |
List of question ids and word counts for each
tags:
- Quiz Bowl
responses:
200:
description: A dictionary containing list of questions
schema:
type: array
items:
$ref: '#/definitions/QuestionResponse'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/question/{question_id}/{position}:
post:
summary: Questions
description: |
Get the requested word for the question
parameters:
- name: question_id
in: path
description: id of question
required: true
type: number
- name: position
in: path
description: position of word
required: true
type: number
tags:
- Quiz Bowl
responses:
200:
description: Nothing if succesful
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/answer/{question_id}:
post:
summary: Submit an answer for a question
description: Answer a question with an answer
parameters:
- name: question_id
in: path
description: Answer to question
required: true
type: string
- name: user_id
in: formData
description: user id
required: true
type: number
- name: api_key
in: formData
type: string
description: api key for user
- name: guess
in: formData
type: string
description: Answer to question
tags:
- Quiz Bowl
responses:
200:
description: Nothing on success
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/info/count:
get:
summary: Count of questions
description: Count of questions
tags:
- Quiz Bowl
responses:
200:
description: OK
schema:
$ref: '#/definitions/CountResponse'
/info/length/{question_id}:
get:
summary: Count of questions
description: Count of questions
parameters:
- name: question_id
in: path
description: Question id
required: true
type: number
tags:
- Quiz Bowl
responses:
200:
description: OK
schema:
$ref: '#/definitions/LengthResponse'
definitions:
QuestionResponse:
type: object
properties:
questions:
type: array
description: list of questions
items:
$ref: '#/definitions/QuestionSummary'
QuestionSummary:
type: object
properties:
id:
type: number
description: id of question for future queries
word_count:
type: number
description: Number of words in this question
CountResponse:
type: object
properties:
count:
type: number
description: Count of number of quiz bowl questions
LengthResponse:
type: object
properties:
length:
type: number
description: Number of words in question
Error:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
fields:
type: string