200 lines
4.8 KiB
YAML
200 lines
4.8 KiB
YAML
swagger: '2.0'
|
|
info:
|
|
title: Device Manager API
|
|
version: '1.0'
|
|
basePath: /api
|
|
schemes:
|
|
- http
|
|
consumes:
|
|
- application/json
|
|
produces:
|
|
- application/json
|
|
|
|
paths:
|
|
/login:
|
|
post:
|
|
summary: Authenticate user
|
|
description: Authenticate user with username and password
|
|
parameters:
|
|
- in: body
|
|
name: body
|
|
description: User credentials
|
|
required: true
|
|
schema:
|
|
type: object
|
|
properties:
|
|
user:
|
|
type: string
|
|
password:
|
|
type: string
|
|
responses:
|
|
'200':
|
|
description: Authentication successful
|
|
schema:
|
|
type: object
|
|
properties:
|
|
token:
|
|
type: string
|
|
'401':
|
|
description: Authentication failed
|
|
schema:
|
|
type: object
|
|
properties:
|
|
message:
|
|
type: string
|
|
|
|
/export:
|
|
get:
|
|
summary: Export data
|
|
description: Get all devices, purchasing information, owner transactions, and location transactions
|
|
responses:
|
|
'200':
|
|
description: Data retrieved successfully
|
|
schema:
|
|
type: object
|
|
properties:
|
|
Devices:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/Device'
|
|
PurchasingInformations:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/PurchasingInformation'
|
|
OwnerTransactions:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/OwnerTransactions'
|
|
LocationTransactions:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/LocationTransactions'
|
|
'401':
|
|
description: Authentication failed
|
|
schema:
|
|
type: object
|
|
properties:
|
|
message:
|
|
type: string
|
|
|
|
/import:
|
|
post:
|
|
summary: Import data
|
|
description: Import device, purchasing information, owner transaction, and location transaction data
|
|
parameters:
|
|
- in: body
|
|
name: body
|
|
description: Data to import
|
|
required: true
|
|
schema:
|
|
type: object
|
|
properties:
|
|
devices:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/Device'
|
|
purchasing_information:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/PurchasingInformation'
|
|
owner_transactions:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/OwnerTransactions'
|
|
location_transactions:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/LocationTransactions'
|
|
responses:
|
|
'200':
|
|
description: Data imported successfully
|
|
schema:
|
|
type: object
|
|
properties:
|
|
devices:
|
|
type: array
|
|
items:
|
|
type: string
|
|
purchasing_information:
|
|
type: array
|
|
items:
|
|
type: string
|
|
owner_transactions:
|
|
type: array
|
|
items:
|
|
type: string
|
|
location_transactions:
|
|
type: array
|
|
items:
|
|
type: string
|
|
'401':
|
|
description: Authentication failed
|
|
schema:
|
|
type: object
|
|
properties:
|
|
message:
|
|
type: string
|
|
|
|
definitions:
|
|
Device:
|
|
type: object
|
|
properties:
|
|
device_id:
|
|
type: string
|
|
title:
|
|
type: string
|
|
device_type:
|
|
type: string
|
|
description:
|
|
type: string
|
|
accessories:
|
|
type: string
|
|
rz_username_buyer:
|
|
type: string
|
|
serial_number:
|
|
type: string
|
|
image_url:
|
|
type: string
|
|
|
|
PurchasingInformation:
|
|
type: object
|
|
properties:
|
|
purchasing_information_id:
|
|
type: string
|
|
price:
|
|
type: string
|
|
timestamp_warranty_end:
|
|
type: string
|
|
timestamp_purchase:
|
|
type: string
|
|
cost_centre:
|
|
type: integer
|
|
seller:
|
|
type: string
|
|
device_id:
|
|
type: string
|
|
|
|
OwnerTransactions:
|
|
type: object
|
|
properties:
|
|
owner_transaction_id:
|
|
type: string
|
|
rz_username:
|
|
type: string
|
|
timestamp_owner_since:
|
|
type: string
|
|
device_id:
|
|
type: string
|
|
|
|
LocationTransactions:
|
|
type: object
|
|
properties:
|
|
location_transaction_id:
|
|
type: string
|
|
room_code:
|
|
type: string
|
|
timestamp_located_since:
|
|
type: string
|
|
device_id:
|
|
type: string
|