Skip to content

Commit

Permalink
WebAPI: Document API using OpenAPI
Browse files Browse the repository at this point in the history
This is simply a demo.
  • Loading branch information
sledgehammer999 committed Nov 10, 2024
1 parent 1e27e65 commit 3e77ff1
Showing 1 changed file with 185 additions and 0 deletions.
185 changes: 185 additions & 0 deletions src/webui/openapi/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
openapi: '3.1.0'
info:
description: This is the specification for qBittorrent's web API
title: qBittorrent WebAPI
version: '2.11.2'
servers:
- url: 'https://localhost:{port}/api/v2'
variables:
port:
default: "8080"
components:
securitySchemes:
defaultApiKey:
description: API key cookie provided when logged in successfully.
type: apiKey
name: SID
in: cookie
security:
- defaultApiKey: []
paths:
/transfer/info:
post:
summary: Returns the global transfer information in JSON format.
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
dl_info_speed:
description: Global download rate in bytes per second
type: number
dl_info_data:
description: Data downloaded this session in bytes
type: number
dl_rate_limit:
description: Download rate limit in bytes per second
type: number
up_info_speed:
description: Global upload rate in bytes per second
type: number
up_info_data:
description: Data uploaded this session in bytes
type: number
up_rate_limit:
description: Upload rate limit in bytes per second
type: number
dht_nodes:
description: Number of DHT nodes connected to
type: number
connection_status:
description: Connection status
type: string
enum:
- connected
- firewalled
- disconnected
required:
- 'dl_info_speed'
- 'dl_info_data'
- 'dl_rate_limit'
- 'up_info_speed'
- 'up_info_data'
- 'up_rate_limit'
- 'dht_nodes'
- 'connection_status'
/transfer/uploadLimit:
get:
summary: Get upload speed limit.
responses:
'200':
description: OK
content:
text/plain; charset=UTF-8:
schema:
type: string
/transfer/downloadLimit:
get:
summary: Get download speed limit.
responses:
'200':
description: OK
content:
text/plain; charset=UTF-8:
schema:
type: string
/transfer/setUploadLimit:
post:
summary: Get upload speed limit.
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
limit:
description: Speed limit in bytes per second. Negative values disable the limit. Non-negative values below 1024 are clamped to 1024.
type: number
required: ['limit']
responses:
'200':
description: OK
/transfer/setDownloadLimit:
post:
summary: Get download speed limit.
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
limit:
description: Speed limit in bytes per second. Negative values disable the limit. Non-negative values below 1024 are clamped to 1024.
type: number
required: ['limit']
responses:
'200':
description: OK
/transfer/toggleSpeedLimitsMode:
get:
summary: Toggle speed limit mode between normal and alternative.
responses:
'200':
description: OK
/transfer/speedLimitsMode:
get:
summary: Get speed limit mode. `1` means alternative mode and `0` normal mode.
responses:
'200':
description: OK
content:
text/plain; charset=UTF-8:
schema:
type: number
enum:
- 0
- 1
/transfer/setSpeedLimitsMode:
post:
summary: Set speed limit mode.
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
mode:
description: '`1` means alternative mode and `0` normal mode.'
type: number
enum:
- 0
- 1
required: ['mode']
responses:
'200':
description: OK
'400':
description: Bad Request
content:
text/plain; charset=UTF-8:
schema:
type: string
const: "'mode': invalid argument"
/transfer/banPeers:
post:
summary: Ban peers.
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
peers:
description: List of peer IPs to ban. Each list item is separated by the `|` character.
type: string
required: ['peers']
responses:
'200':
description: OK

0 comments on commit 3e77ff1

Please sign in to comment.