Skip to content

Commit 5b86dac

Browse files
WebAPI: Document API using OpenAPI
This is simply a demo.
1 parent 1e27e65 commit 5b86dac

File tree

1 file changed

+185
-0
lines changed

1 file changed

+185
-0
lines changed

src/webui/openapi/main.yml

+185
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
openapi: '3.1.0'
2+
info:
3+
description: This is the specification for qBittorrent's web API
4+
title: qBittorrent WebAPI
5+
version: '1.0'
6+
servers:
7+
- url: 'https://localhost:{port}/api/v2'
8+
variables:
9+
port:
10+
default: "8080"
11+
components:
12+
securitySchemes:
13+
defaultApiKey:
14+
description: API key cookie provided when logged in successfully.
15+
type: apiKey
16+
name: SID
17+
in: cookie
18+
security:
19+
- defaultApiKey: []
20+
paths:
21+
/transfer/info:
22+
post:
23+
summary: Returns the global transfer information in JSON format.
24+
responses:
25+
'200':
26+
description: OK
27+
content:
28+
application/json:
29+
schema:
30+
type: object
31+
properties:
32+
dl_info_speed:
33+
description: Global download rate in bytes per second
34+
type: number
35+
dl_info_data:
36+
description: Data downloaded this session in bytes
37+
type: number
38+
dl_rate_limit:
39+
description: Download rate limit in bytes per second
40+
type: number
41+
up_info_speed:
42+
description: Global upload rate in bytes per second
43+
type: number
44+
up_info_data:
45+
description: Data uploaded this session in bytes
46+
type: number
47+
up_rate_limit:
48+
description: Upload rate limit in bytes per second
49+
type: number
50+
dht_nodes:
51+
description: Number of DHT nodes connected to
52+
type: number
53+
connection_status:
54+
description: Connection status
55+
type: string
56+
enum:
57+
- connected
58+
- firewalled
59+
- disconnected
60+
required:
61+
- 'dl_info_speed'
62+
- 'dl_info_data'
63+
- 'dl_rate_limit'
64+
- 'up_info_speed'
65+
- 'up_info_data'
66+
- 'up_rate_limit'
67+
- 'dht_nodes'
68+
- 'connection_status'
69+
/transfer/uploadLimit:
70+
get:
71+
summary: Get upload speed limit.
72+
responses:
73+
'200':
74+
description: OK
75+
content:
76+
text/plain; charset=UTF-8:
77+
schema:
78+
type: string
79+
/transfer/downloadLimit:
80+
get:
81+
summary: Get download speed limit.
82+
responses:
83+
'200':
84+
description: OK
85+
content:
86+
text/plain; charset=UTF-8:
87+
schema:
88+
type: string
89+
/transfer/setUploadLimit:
90+
post:
91+
summary: Get upload speed limit.
92+
requestBody:
93+
required: true
94+
content:
95+
application/x-www-form-urlencoded:
96+
schema:
97+
type: object
98+
properties:
99+
limit:
100+
description: Speed limit in bytes per second. Negative values disable the limit. Non-negative values below 1024 are clamped to 1024.
101+
type: number
102+
required: ['limit']
103+
responses:
104+
'200':
105+
description: OK
106+
/transfer/setDownloadLimit:
107+
post:
108+
summary: Get download speed limit.
109+
requestBody:
110+
required: true
111+
content:
112+
application/x-www-form-urlencoded:
113+
schema:
114+
type: object
115+
properties:
116+
limit:
117+
description: Speed limit in bytes per second. Negative values disable the limit. Non-negative values below 1024 are clamped to 1024.
118+
type: number
119+
required: ['limit']
120+
responses:
121+
'200':
122+
description: OK
123+
/transfer/toggleSpeedLimitsMode:
124+
get:
125+
summary: Toggle speed limit mode between normal and alternative.
126+
responses:
127+
'200':
128+
description: OK
129+
/transfer/speedLimitsMode:
130+
get:
131+
summary: Get speed limit mode. `1` means alternative mode and `0` normal mode.
132+
responses:
133+
'200':
134+
description: OK
135+
content:
136+
text/plain; charset=UTF-8:
137+
schema:
138+
type: number
139+
enum:
140+
- 0
141+
- 1
142+
/transfer/setSpeedLimitsMode:
143+
post:
144+
summary: Set speed limit mode.
145+
requestBody:
146+
required: true
147+
content:
148+
application/x-www-form-urlencoded:
149+
schema:
150+
type: object
151+
properties:
152+
mode:
153+
description: '`1` means alternative mode and `0` normal mode.'
154+
type: number
155+
enum:
156+
- 0
157+
- 1
158+
required: ['mode']
159+
responses:
160+
'200':
161+
description: OK
162+
'400':
163+
description: Bad Request
164+
content:
165+
text/plain; charset=UTF-8:
166+
schema:
167+
type: string
168+
const: "'mode': invalid argument"
169+
/transfer/banPeers:
170+
post:
171+
summary: Ban peers.
172+
requestBody:
173+
required: true
174+
content:
175+
application/x-www-form-urlencoded:
176+
schema:
177+
type: object
178+
properties:
179+
peers:
180+
description: List of peer IPs to ban. Each list item is separated by the `|` character.
181+
type: string
182+
required: ['peers']
183+
responses:
184+
'200':
185+
description: OK

0 commit comments

Comments
 (0)