Add create recording http endpoint

master
esensar 2018-09-21 00:16:01 +02:00
parent 3beae5b0d5
commit 5d9264cfbb
3 changed files with 32 additions and 1 deletions

View File

@ -107,6 +107,13 @@ class DeviceRecordingResource(ProtectedResource):
return RecordingsWrapperSchema().dump( return RecordingsWrapperSchema().dump(
{'recordings': devices.get_device_recordings(device_id)}), 200 {'recordings': devices.get_device_recordings(device_id)}), 200
@swag_from('swagger/create_device_recording_spec.yaml')
def post(self, device_id):
validate_device_ownership(device_id)
success = devices.create_recording(device_id, request.json)
if success:
return '', 201
class DeviceListResource(ProtectedResource): class DeviceListResource(ProtectedResource):
@use_args(DeviceWrapperSchema()) @use_args(DeviceWrapperSchema())

View File

@ -0,0 +1,24 @@
Creates new recoding
---
tags:
- Recording
- Device
parameters:
- in: path
name: device_id
required: true
type: integer
description: Id of the device
- in: body
name: body
required: true
schema:
type: object
required:
- recording
properties:
recording:
$ref: '#/definitions/Recording'
responses:
201:
description: Successful creation

View File

@ -7,7 +7,7 @@ parameters:
name: dashboard_id name: dashboard_id
required: true required: true
type: integer type: integer
description: Id of the device description: Id of the dashboard
- in: body - in: body
name: body name: body
required: true required: true