457 lines
12 KiB
YAML
457 lines
12 KiB
YAML
swagger: '2.0'
|
|
info:
|
|
title: ebusd-http
|
|
description: The API that ebusd provides on HTTP port.
|
|
version: '3.0'
|
|
schemes:
|
|
- http
|
|
produces:
|
|
- 'application/json;charset=utf-8'
|
|
host: 'l:8080'
|
|
paths:
|
|
/data:
|
|
get:
|
|
summary: Get all messages of all circuits.
|
|
responses:
|
|
'200':
|
|
description: Success.
|
|
schema:
|
|
$ref: '#/definitions/Data'
|
|
'400':
|
|
$ref: '#/responses/BadRequest'
|
|
'403':
|
|
$ref: '#/responses/NotAuthorized'
|
|
'404':
|
|
$ref: '#/responses/NotFound'
|
|
'500':
|
|
$ref: '#/responses/GeneralError'
|
|
parameters:
|
|
- $ref: '#/parameters/sinceQuery'
|
|
- $ref: '#/parameters/pollQuery'
|
|
- $ref: '#/parameters/verboseQuery'
|
|
- $ref: '#/parameters/indexedQuery'
|
|
- $ref: '#/parameters/numericQuery'
|
|
- $ref: '#/parameters/valuenameQuery'
|
|
- $ref: '#/parameters/fullQuery'
|
|
- $ref: '#/parameters/requiredQuery'
|
|
- $ref: '#/parameters/writeQuery'
|
|
- $ref: '#/parameters/rawQuery'
|
|
- $ref: '#/parameters/defQuery'
|
|
- $ref: '#/parameters/userQuery'
|
|
- $ref: '#/parameters/secretQuery'
|
|
/data/{circuit}:
|
|
get:
|
|
summary: Get all messages of a particular circuit.
|
|
responses:
|
|
'200':
|
|
description: Success.
|
|
schema:
|
|
$ref: '#/definitions/Data'
|
|
'400':
|
|
$ref: '#/responses/BadRequest'
|
|
'403':
|
|
$ref: '#/responses/NotAuthorized'
|
|
'404':
|
|
$ref: '#/responses/NotFound'
|
|
'500':
|
|
$ref: '#/responses/GeneralError'
|
|
parameters:
|
|
- $ref: '#/parameters/circuitParam'
|
|
- $ref: '#/parameters/sinceQuery'
|
|
- $ref: '#/parameters/pollQuery'
|
|
- $ref: '#/parameters/exactQuery'
|
|
- $ref: '#/parameters/verboseQuery'
|
|
- $ref: '#/parameters/indexedQuery'
|
|
- $ref: '#/parameters/numericQuery'
|
|
- $ref: '#/parameters/valuenameQuery'
|
|
- $ref: '#/parameters/fullQuery'
|
|
- $ref: '#/parameters/requiredQuery'
|
|
- $ref: '#/parameters/writeQuery'
|
|
- $ref: '#/parameters/rawQuery'
|
|
- $ref: '#/parameters/defQuery'
|
|
- $ref: '#/parameters/userQuery'
|
|
- $ref: '#/parameters/secretQuery'
|
|
/data/{circuit}/{message}:
|
|
get:
|
|
summary: Get a particular message of a particular circuit.
|
|
responses:
|
|
'500':
|
|
$ref: '#/responses/NotFound'
|
|
'200':
|
|
description: Success
|
|
schema:
|
|
$ref: '#/definitions/Data'
|
|
parameters:
|
|
- $ref: '#/parameters/circuitParam'
|
|
- $ref: '#/parameters/messageParam'
|
|
- $ref: '#/parameters/sinceQuery'
|
|
- $ref: '#/parameters/pollQuery'
|
|
- $ref: '#/parameters/exactQuery'
|
|
- $ref: '#/parameters/verboseQuery'
|
|
- $ref: '#/parameters/indexedQuery'
|
|
- $ref: '#/parameters/numericQuery'
|
|
- $ref: '#/parameters/valuenameQuery'
|
|
- $ref: '#/parameters/fullQuery'
|
|
- $ref: '#/parameters/requiredQuery'
|
|
- $ref: '#/parameters/writeQuery'
|
|
- $ref: '#/parameters/rawQuery'
|
|
- $ref: '#/parameters/defQuery'
|
|
- $ref: '#/parameters/userQuery'
|
|
- $ref: '#/parameters/secretQuery'
|
|
/{file}:
|
|
get:
|
|
summary: Retrieve a particular file.
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
schema:
|
|
type: 'file'
|
|
'400':
|
|
$ref: '#/responses/BadRequest'
|
|
'403':
|
|
$ref: '#/responses/NotAuthorized'
|
|
'404':
|
|
$ref: '#/responses/NotFound'
|
|
'500':
|
|
$ref: '#/responses/GeneralError'
|
|
produces:
|
|
- text/html
|
|
- text/css
|
|
- application/javascript
|
|
- image/png
|
|
- image/jpeg
|
|
- image/svg+xml
|
|
- 'application/json;charset=utf-8'
|
|
- 'application/yaml;charset=utf-8'
|
|
head:
|
|
summary: Retrieve headers for a certain file.
|
|
responses:
|
|
'400':
|
|
$ref: '#/responses/NotFound'
|
|
'200':
|
|
description: Success
|
|
schema:
|
|
$ref: '#/definitions/Data'
|
|
parameters:
|
|
- name: file
|
|
in: path
|
|
required: true
|
|
description: the file to retrieve.
|
|
type: string
|
|
definitions:
|
|
Global:
|
|
type: object
|
|
properties:
|
|
version:
|
|
type: string
|
|
description: the ebusd version (major.minor.sha1 or major.minor.date).
|
|
pattern: '[0-9]+\.[0-9]+\.[0-9a-f]+\.'
|
|
example: '3.0.1234abc'
|
|
updatecheck:
|
|
type: string
|
|
description: the result of update check ("OK" or string describing available updates).
|
|
example: 'revision 1234abd available, 5 newer configuration files available'
|
|
signal:
|
|
type: boolean
|
|
description: whether signal is available.
|
|
example: true
|
|
symbolrate:
|
|
type: integer
|
|
description: the current symbol rate on the bus.
|
|
minimum: 0
|
|
example: 31
|
|
maxsymbolrate:
|
|
type: integer
|
|
description: the maximum symbol rate on the bus seen since start.
|
|
minimum: 0
|
|
example: 167
|
|
qq:
|
|
type: integer
|
|
description: the ebusd master address (only if not readonly).
|
|
minimum: 0
|
|
maximum: 255
|
|
example: 49
|
|
reconnects:
|
|
type: integer
|
|
description: the number of reconnects to the device since start.
|
|
minimum: 0
|
|
example: 0
|
|
masters:
|
|
type: integer
|
|
description: the number of masters recognized on the bus.
|
|
minimum: 0
|
|
example: 5
|
|
messages:
|
|
type: integer
|
|
description: the number of known message definitions.
|
|
minimum: 0
|
|
example: 893
|
|
lastup:
|
|
type: integer
|
|
description: the time in UTC seconds of the last update of any message.
|
|
minimum: 0
|
|
example: 1493483370
|
|
required:
|
|
- version
|
|
- signal
|
|
- reconnects
|
|
- masters
|
|
- messages
|
|
- lastup
|
|
Circuit:
|
|
type: object
|
|
properties:
|
|
name:
|
|
type: string
|
|
description: the circuit name.
|
|
zz:
|
|
type: integer
|
|
description: the circuit slave address.
|
|
minimum: 0
|
|
maximum: 255
|
|
example: 8
|
|
messages:
|
|
type: object
|
|
additionalProperties:
|
|
$ref: '#/definitions/Message'
|
|
Message:
|
|
type: object
|
|
properties:
|
|
name:
|
|
type: string
|
|
description: the message name.
|
|
passive:
|
|
type: boolean
|
|
description: true when this is a passive message.
|
|
write:
|
|
type: boolean
|
|
description: true for a write message, false for a read message.
|
|
lastup:
|
|
type: integer
|
|
description: the time in UTC seconds of the last update of the message (0 for never).
|
|
minimum: 0
|
|
qq:
|
|
type: integer
|
|
description: limited source master address (only with def).
|
|
minimum: 0
|
|
maximum: 255
|
|
example: 49
|
|
zz:
|
|
type: integer
|
|
description: destination master or slave address.
|
|
minimum: 0
|
|
maximum: 255
|
|
example: 8
|
|
id:
|
|
type: array
|
|
description: the message ID composed of PBSB and further master data bytes (only with def).
|
|
items:
|
|
type: integer
|
|
minimum: 0
|
|
maximum: 255
|
|
comment:
|
|
type: string
|
|
description: the message comment (only with verbose).
|
|
master:
|
|
type: array
|
|
description: the last seen master data bytes (only with raw and if available).
|
|
items:
|
|
type: integer
|
|
minimum: 0
|
|
maximum: 255
|
|
slave:
|
|
type: array
|
|
description: the last seen slave data bytes (only with raw and if available).
|
|
items:
|
|
type: integer
|
|
minimum: 0
|
|
maximum: 255
|
|
fields:
|
|
type: object
|
|
description: the decoded fields the message is composed of (only if available).
|
|
additionalProperties:
|
|
$ref: '#/definitions/Field'
|
|
fielddefs:
|
|
type: array
|
|
description: the field definitions the message is composed of (only with def).
|
|
items:
|
|
$ref: '#/definitions/FieldDef'
|
|
required:
|
|
- name
|
|
- passive
|
|
- write
|
|
- lastup
|
|
Field:
|
|
type: object
|
|
properties:
|
|
name:
|
|
type: string
|
|
description: the field name.
|
|
value:
|
|
description: the field value.
|
|
unit:
|
|
type: string
|
|
description: the field unit (only with verbose).
|
|
comment:
|
|
type: string
|
|
description: the field comment (only with verbose).
|
|
FieldDef:
|
|
type: object
|
|
properties:
|
|
name:
|
|
type: string
|
|
description: the field name.
|
|
slave:
|
|
type: boolean
|
|
description: whether the field is part of the slave data.
|
|
type:
|
|
type: string
|
|
description: the field type.
|
|
isbits:
|
|
type: boolean
|
|
description: true when the length is in bits.
|
|
length:
|
|
type: number
|
|
description: the field length in bytes (-1 for remainder, number of bits when isbits is true).
|
|
divisor:
|
|
type: number
|
|
description: the extra divisor applied to the raw value (only if applicable).
|
|
value:
|
|
type: string
|
|
description: the constant value (only if applicable).
|
|
verify:
|
|
type: boolean
|
|
description: whether the constant value is verified when decoding (only if applicable).
|
|
values:
|
|
type: object
|
|
description: the raw numeric value to name assignments (only if applicable).
|
|
additionalProperties:
|
|
type: string
|
|
description: the value name.
|
|
unit:
|
|
type: string
|
|
description: the field unit.
|
|
comment:
|
|
type: string
|
|
description: the field comment.
|
|
required:
|
|
- name
|
|
- slave
|
|
- type
|
|
- isbits
|
|
- length
|
|
Data:
|
|
type: object
|
|
properties:
|
|
global:
|
|
$ref: '#/definitions/Global'
|
|
additionalProperties:
|
|
$ref: '#/definitions/Circuit'
|
|
required:
|
|
- global
|
|
parameters:
|
|
circuitParam:
|
|
name: circuit
|
|
in: path
|
|
required: true
|
|
type: string
|
|
messageParam:
|
|
name: message
|
|
in: path
|
|
required: true
|
|
type: string
|
|
sinceQuery:
|
|
name: since
|
|
in: query
|
|
description: limit to messages that have changed since the specified UTC seconds.
|
|
type: integer
|
|
minimum: 0
|
|
allowEmptyValue: false
|
|
pollQuery:
|
|
name: poll
|
|
in: query
|
|
description: set the poll priority of matching message(s) to prio.
|
|
type: integer
|
|
minimum: 0
|
|
allowEmptyValue: false
|
|
exactQuery:
|
|
name: exact
|
|
in: query
|
|
description: exact search for circuit/message name.
|
|
type: boolean
|
|
allowEmptyValue: false
|
|
verboseQuery:
|
|
name: verbose
|
|
in: query
|
|
description: include comments and field units.
|
|
type: boolean
|
|
allowEmptyValue: false
|
|
indexedQuery:
|
|
name: indexed
|
|
in: query
|
|
description: always return field indexes instead of names.
|
|
type: boolean
|
|
allowEmptyValue: false
|
|
numericQuery:
|
|
name: numeric
|
|
in: query
|
|
description: return numeric values of value list entries.
|
|
type: boolean
|
|
allowEmptyValue: false
|
|
valuenameQuery:
|
|
name: valuename
|
|
in: query
|
|
description: include value and name for named values.
|
|
type: boolean
|
|
allowEmptyValue: false
|
|
fullQuery:
|
|
name: full
|
|
in: query
|
|
description: include all available attributes.
|
|
type: boolean
|
|
allowEmptyValue: false
|
|
requiredQuery:
|
|
name: required
|
|
in: query
|
|
description: retrieve the data from the bus if not yet cached.
|
|
type: boolean
|
|
allowEmptyValue: false
|
|
writeQuery:
|
|
name: write
|
|
in: query
|
|
description: retrieve write messages in addition to read/poll messages.
|
|
type: boolean
|
|
allowEmptyValue: false
|
|
rawQuery:
|
|
name: raw
|
|
in: query
|
|
description: include raw master/slave data.
|
|
type: boolean
|
|
allowEmptyValue: false
|
|
defQuery:
|
|
name: def
|
|
in: query
|
|
description: include message and field definition.
|
|
type: boolean
|
|
allowEmptyValue: false
|
|
userQuery:
|
|
name: user
|
|
in: query
|
|
description: authenticate with user name.
|
|
type: string
|
|
allowEmptyValue: false
|
|
secretQuery:
|
|
name: secret
|
|
in: query
|
|
description: authenticate with user secret.
|
|
type: string
|
|
allowEmptyValue: false
|
|
responses:
|
|
BadRequest:
|
|
description: Invalid request parameters.
|
|
NotFound:
|
|
description: Circuit or message not found.
|
|
NotAuthorized:
|
|
description: User not authorized.
|
|
GeneralError:
|
|
description: General error. |