From c9a9d3cb067b0d6346bdcc94b7cbb17c764f1098 Mon Sep 17 00:00:00 2001 From: Vishal Banthia Date: Mon, 7 Dec 2015 18:39:06 +0900 Subject: [PATCH] User path parameter for Delete /user/devices/:device endpoint --- lib/units/api/controllers/user.js | 2 +- lib/units/api/swagger/api_v1.yaml | 19 ++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/lib/units/api/controllers/user.js b/lib/units/api/controllers/user.js index 26d5310c..779b4a70 100644 --- a/lib/units/api/controllers/user.js +++ b/lib/units/api/controllers/user.js @@ -97,7 +97,7 @@ function addDeviceToUser(req, res) { } function deleteDeviceFromUser(req, res) { - var serial = req.body.serial + var serial = req.swagger.params.serial.value dbapi.loadDevice(serial) .then(function(device) { diff --git a/lib/units/api/swagger/api_v1.yaml b/lib/units/api/swagger/api_v1.yaml index dc6138af..bf7b380f 100644 --- a/lib/units/api/swagger/api_v1.yaml +++ b/lib/units/api/swagger/api_v1.yaml @@ -84,6 +84,8 @@ paths: $ref: "#/definitions/ErrorResponse" security: - accessTokenAuth: [] + /user/devices/{serial}: + x-swagger-router-controller: user delete: summary: Release device from user description: The User Devices endpoint will request for device release from stf server. @@ -91,12 +93,11 @@ paths: tags: - user parameters: - - name: device - in: body - description: Device to add + - name: serial + in: path + description: Device Serial required: true - schema: - $ref: "#/definitions/DeviceDeletePayload" + type: string responses: "202": description: Device Release Request Status @@ -222,14 +223,6 @@ definitions: timeout: description: Device timeout in ms. If device is kept idle for this period, it will be automatically disconnected. Default is provider group timeout. type: integer - DeviceDeletePayload: - description: payload object for deleting device from user - required: - - serial - properties: - serial: - description: Device Serial - type: string securityDefinitions: accessTokenAuth: