{"openapi":"3.0.1","info":{"title":"3rd Party Device Mocked API","description":"Mocked API for Development process purposes.","version":"0.1-oas3"},"servers":[{"url":"https://bq1xc5ikx9.execute-api.us-east-1.amazonaws.com"}],"paths":{"/dev/authorize":{"post":{"summary":"Generate Authorization Code.","description":"Initiates the Authorization process based on oAuth 2.0 **\"grant_type=authorization_code\"** flow.","tags":["Authorization"],"parameters":[{"in":"query","name":"client_id","schema":{"type":"string"},"required":true,"description":"ClientId credential."},{"in":"query","name":"response_type","schema":{"type":"string"},"required":true,"description":"ResponseType (**set to \"authorization_code\"**)."}],"requestBody":{"description":"Authorization body including **\"client_secret\"** value","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestAuthBody"}}}},"responses":{"200":{"description":"Authorization code","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseAuthBody"},"examples":{"0":{"value":"{\n  \"code\":\"d9a41864-e027-4d2f-b8fc-bdb97d179a43\"\n}"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"},"examples":{"0":{"value":"{\n  \"error\":\"Unauthorized\"\n}"}}}}}}}},"/dev/token":{"post":{"summary":"Generate pair of Access Token and Refresh Token.","description":"Provides a pair of an **access_token** and a **refresh_token**. If *\"grant_type=authorization_code\"*, a *code=[authCode]* body param will be required. If *\"grant_type=refresh_token\"*, a *refresh_token=[refreshToken]* body param will be required.","tags":["Authorization"],"requestBody":{"description":"Optional description in *Markdown*","required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/AccessTokenBody"},{"$ref":"#/components/schemas/RefreshTokenBody"}]}}}},"responses":{"200":{"description":"Returns access and refresh token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponseBody"},"examples":{"0":{"value":"{\n  \"access_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRJZCI6ImNsaWVudDAyIiwiY2xpZW50U2VjcmV0Ijoic2VjcmV0MDIiLCJ0eXBlIjoiYWNjZXNzIiwiaWF0IjoxNjM0NjczNDg1LCJleHAiOjE2MzQ2NzcwODV9.f0RPBQtbfozTa7JYY1OxPfx5eTAOpPC-asc7IE5uaPg\",\n  \"refresh_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRJZCI6ImNsaWVudDAyIiwiY2xpZW50U2VjcmV0Ijoic2VjcmV0MDIiLCJ0eXBlIjoicmVmcmVzaCIsImlhdCI6MTYzNDY3MzQ4NSwiZXhwIjoxNjQyNDQ5NDg1fQ.gv4fxlno-9cmFLCMIJamv_mCvnmaMQeixqEwY0Cpxnk\",\n  \"token_type\": \"bearer\",\n  \"expires\": 7776000\n}"}}}}}}}},"/dev/device":{"get":{"summary":"Get All Devices.","description":"Get the complete list of available devices.","tags":["Device"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"List of all devices","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DeviceBody"}},"examples":{"0":{"value":"[\n  {\n    \"manufacturerId\":\"d9a41864-e027-4d2f-b8fc-bdb97d179a43\",\n    \"deviceId\":\"1\",\n    \"deviceName\":\"On Example Device\",\n    \"state\":\"off\"\n  },\n  {\n    \"manufacturerId\":\"b5bc1e2d-a418-40d4-959e-93b99124ac76\",\n    \"deviceId\":\"4\",\n    \"deviceName\":\"Off Example Device\",\n    \"state\":\"on\"\n  },\n  {\n    \"manufacturerId\":\"ce969e45-ecfe-442a-a3c3-1028487196b3\",\n    \"deviceId\":\"5\",\n    \"deviceName\":\"Other Example Device\",\n    \"state\":\"on\"\n  }\n]"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"},"examples":{"0":{"value":"{\n  \"error\":\"Unauthorized\"\n}"}}}}}}}},"/dev/device/{id}":{"get":{"summary":"Get Device By Id.","description":"Get a specific device by id.","tags":["Device"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"integer"},"required":true,"description":"Numeric ID of the device to get."}],"responses":{"200":{"description":"DeviceId = 1","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceBody"},"examples":{"0":{"value":"{\n  \"manufacturerId\":\"d9a41864-e027-4d2f-b8fc-bdb97d179a43\",\n  \"deviceId\":\"1\",\n  \"deviceName\":\"On Example Device\",\n  \"state\":\"off\"\n}"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"},"examples":{"0":{"value":"{\n  \"error\":\"Unauthorized\"\n}"}}}}}}},"put":{"summary":"Update Device State.","description":"Update the state of the specified device by id.","tags":["Device"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"integer"},"required":true,"description":"Numeric ID of the device to get."}],"responses":{"200":{"description":"Updated device","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceBody"},"examples":{"0":{"value":"{\n  \"manufacturerId\":\"d9a41864-e027-4d2f-b8fc-bdb97d179a43\",\n  \"deviceId\":\"1\",\n  \"deviceName\":\"On Example Device\",\n  \"state\":\"on\"\n}"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"},"examples":{"0":{"value":"{\n  \"error\":\"Unauthorized\"\n}"}}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"DeviceBody":{"type":"object","properties":{"manufacturerId":"string","deviceId":"string","deviceName":"string","state":"string"}},"ErrorBody":{"type":"object","properties":{"error":"string"}},"AccessTokenBody":{"type":"object","properties":{"grant_type":{"type":"string","default":"authorization_code"},"client_id":{"type":"string"},"client_secret":{"type":"string"},"code":{"type":"string"}},"required":["grant_type","client_id","client_secret","code"]},"ResponseAuthBody":{"type":"object","properties":{"code":{"type":"string"}}},"RequestAuthBody":{"type":"object","properties":{"client_secret":{"type":"string"}},"required":["client_secret"]},"RefreshTokenBody":{"type":"object","properties":{"grant_type":{"type":"string","default":"refresh_token"},"client_id":{"type":"string"},"client_secret":{"type":"string"},"refresh_token":{"type":"string"}},"required":["grant_type","client_id","client_secret","refresh_token"]},"TokenResponseBody":{"type":"object","properties":{"access_token":"string","refresh_token":"string","token_type":"string","expires":"integer"}}}},"tags":[{"name":"Authorization"},{"name":"Device"}]}