Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- openapi: 3.0.0
- servers:
- - url: 'http://35.160.74.40:8088/'
- - url: 'http://127.0.0.1:8088/'
- info:
- description: 420bits API integration documentation
- version: "0.0.1-oas3"
- title: 420bits Open API
- contact:
- email: bits420bits@gmail.com
- license:
- name: Apache 2.0
- url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
- paths:
- /auth:
- post:
- tags:
- - Auth
- summary: Authentication
- description: Creates an authentication session
- responses:
- '200':
- description: Credentials
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/AuthResponse'
- '201':
- description: Invalid credentials
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/AuthRequest'
- description: User to be created
- required: true
- /users:
- post:
- tags:
- - Users
- summary: Creates a new user
- description: Adds a user to the system
- parameters:
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success - Authenticate the user and return the credentials
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/AuthResponse'
- '201':
- description: Invalid data
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/CreateUserRequest'
- description: User to be created
- required: true
- delete:
- tags:
- - Users
- summary: Deletes user
- description: Delets a user
- parameters:
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DeleteUserResponse'
- '201':
- description: Invalid data
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DeleteUserRequest'
- description: User id to be deleted
- required: true
- /places:
- post:
- tags:
- - Places
- summary: Create or update a place
- description: Create or update a new place information.
- parameters:
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/CreatePlaceResponse'
- '201':
- description: Invalid data
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/CreatePlaceRequest'
- description: >-
- The information of the place will be created. Include the `_id` field
- if you want to update the information.
- required: true
- get:
- tags:
- - Places
- summary: Places list endpoint
- description: Returns the list of places the user has access to
- parameters:
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/GetPlacesResponse'
- '201':
- description: Invalid data
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- delete:
- tags:
- - Places
- summary: Delete a place
- description: Delete a place that the user has access to
- parameters:
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DeletePlaceResponse'
- '201':
- description: Invalid data
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DeletePlaceRequest'
- description: Place id to be deleted
- required: true
- /rooms:
- post:
- tags:
- - Rooms
- summary: Create or update a room information
- description: Create or update a room information
- parameters:
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/CreateRoomResponse'
- '201':
- description: Invalid data
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/CreateRoomRequest'
- description: >-
- The information of the room will be created. Include the `_id` field
- if you want to update the information.
- required: true
- get:
- tags:
- - Rooms
- summary: Get a list of rooms
- description: Returns all the rooms of a specific place
- parameters:
- - $ref: '#/components/parameters/place_id'
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/GetReoomsResponse'
- '201':
- description: Invalid data
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- delete:
- tags:
- - Rooms
- summary: Delete a room
- description: Delete a room the user has access to
- parameters:
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DeleteRoomResponse'
- '201':
- description: Invalid data
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DeleteRoomRequest'
- description: Room id to be deleted
- required: true
- /accessory_setup_session:
- post:
- tags:
- - Accessory setup session
- summary: Creates a session to setup a new acccessory
- description: 'In order to create a new accessory, a session toke is requried'
- parameters:
- - $ref: '#/components/parameters/Jwt'
- - $ref: '#/components/parameters/room_id'
- responses:
- '200':
- description: Success
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/AccessorySetupSessionResponse'
- '201':
- description: Invalid data
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- '/accessories/[accessory_id]':
- post:
- tags:
- - Accessories
- summary: Update accessory
- description: >-
- Update accessory information given an accessory id. Include ONLY the
- parameters you want to update.
- parameters:
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/CreateAccessoryObject'
- '201':
- description: Invalid data
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/CreateAccessoryObject'
- description: The information of the accessories will be updated.
- required: true
- /accessories:
- get:
- tags:
- - Accessories
- summary: All the accessories use has access to
- description: This API will return a single list of accessories the use has access to.
- parameters:
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/GetAccessoriesResponse'
- '201':
- description: Invalid data
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- post:
- tags:
- - Accessories
- summary: Create an accessory(ies)
- description: Create an accessory(ies)
- parameters:
- - $ref: '#/components/parameters/Jwt'
- - $ref: '#/components/parameters/setup_session_id'
- responses:
- '200':
- description: Success
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/CreateAccessoryResponse'
- '201':
- description: Invalid data
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/CreateAccessoryRequest'
- description: The information of the accessories will be created.
- required: true
- delete:
- tags:
- - Accessories
- summary: Delete an accessory
- description: Delete an accessory that the user has access to
- parameters:
- - $ref: '#/components/parameters/Jwt'
- responses:
- '200':
- description: Success
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DeleteAccessoryResponse'
- '201':
- description: Invalid data
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/DeleteAccessoryRequest'
- description: Accessory id to be deleted
- required: true
- /place_dashboard:
- get:
- tags:
- - Dashboard
- summary: The dashboard of a place
- description: >-
- Return the dashboard of the selected place for the current loged in
- user. The accessory can contain a `layout_metadata` field containing
- metadata.
- parameters:
- - $ref: '#/components/parameters/Jwt'
- - $ref: '#/components/parameters/place_id'
- responses:
- '200':
- description: Success
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/PlaceDashboardResponse'
- '201':
- description: Invalid data
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- /room_dashboard:
- get:
- tags:
- - Dashboard
- summary: The dashboard of a room
- description: >-
- Return the dashboard of the selected room for the current loged in user.
- The accessory can contain a `layout_metadata` field containing metadata.
- parameters:
- - $ref: '#/components/parameters/Jwt'
- - $ref: '#/components/parameters/room_id'
- responses:
- '200':
- description: Success
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/RoomDashboardResponse'
- '201':
- description: Invalid data
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- /accessories_logs:
- get:
- tags:
- - Accessories logs
- summary: Return a list of accessories data log.
- description: >-
- Return a list of accessories data log. Mostly used to plot data on
- charts.
- parameters:
- - $ref: '#/components/parameters/Jwt'
- - $ref: '#/components/parameters/accessory_id'
- - $ref: '#/components/parameters/update_topic'
- - $ref: '#/components/parameters/mac_id'
- - $ref: '#/components/parameters/local_id'
- - $ref: '#/components/parameters/room_id'
- responses:
- '200':
- description: Success
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/AccessoriesLogsResponse'
- '201':
- description: Invalid data
- content:
- '*/*':
- schema:
- $ref: '#/components/schemas/DefaultErrorResponse'
- components:
- schemas:
- DashboardRoom:
- type: object
- required:
- - _id
- - name
- - accessories
- properties:
- _id:
- type: string
- example: 5985270044ed65484b7085a8
- name:
- type: string
- example: My room
- accessories:
- type: array
- items:
- $ref: '#/components/schemas/CreateAccessoryObject'
- DashboardPlace:
- type: object
- required:
- - _id
- - name
- - owner_user
- - rooms
- properties:
- _id:
- type: string
- example: 59851f1f44ed65484b708375
- name:
- type: string
- example: My new place
- owner_user:
- $ref: '#/components/schemas/UserObject'
- rooms:
- type: array
- items:
- $ref: '#/components/schemas/DashboardRoom'
- AccessoryLog:
- type: object
- required:
- - creation_date
- - accessory
- properties:
- creation_date:
- type: number
- example: '1506122645.79601'
- accessory:
- $ref: '#/components/schemas/CreateAccessoryResponse'
- AccessoriesLogsResponse:
- type: object
- required:
- - logs
- properties:
- logs:
- type: array
- items:
- $ref: '#/components/schemas/AccessoryLog'
- PlaceDashboardResponse:
- type: object
- required:
- - place
- properties:
- place:
- $ref: '#/components/schemas/DashboardPlace'
- RoomDashboardResponse:
- type: object
- required:
- - room
- properties:
- room:
- $ref: '#/components/schemas/DashboardRoom'
- AccessorySetupSession:
- type: object
- required:
- - user_id
- - _id
- - jwt
- properties:
- room_id:
- type: string
- example: 5985270044ed65484b7085a8
- user_id:
- type: string
- example: 59851d5d44ed65484b7082e9
- _id:
- type: string
- example: 59853a1544ed65484b708b1c
- jwt:
- type: string
- example: 1501896038.92-59851d5d44ed65484b7082e9
- AccessorySetupSessionResponse:
- type: object
- required:
- - accessory_setup_session
- properties:
- accessory_setup_session:
- $ref: '#/components/schemas/AccessorySetupSession'
- CreateAccessoryResponse:
- type: array
- items:
- $ref: '#/components/schemas/CreateAccessoryObject'
- CreateAccessoryRequest:
- type: array
- items:
- $ref: '#/components/schemas/CreateAccessoryObject'
- CreateAccessoryObject:
- type: object
- required:
- - local_id
- - mac_id
- - layout_type
- - accessory_type
- properties:
- _id:
- type: string
- accessory_type:
- type: string
- example: '1'
- layout_type:
- type: string
- example: '1'
- name:
- type: string
- example: Default accessory name
- alias:
- type: string
- example: Room's light
- mac_id:
- type: string
- example: 'a0:20:a6:1b:5e:97'
- local_id:
- type: string
- example: 'a0:20:a6:1b:5e:97'
- is_online:
- type: boolean
- example: true
- last_contact_timestamp:
- type: number
- example: 1501893040.761755
- current_value:
- type: string
- example: '10'
- value_type:
- type: string
- example: string
- values_allowed:
- type: array
- example:
- - '100'
- - '10'
- - '22'
- update_topic:
- type: string
- example: 'accessory/update/a0:20:a6:1b:5e:97/1'
- allow_edit:
- type: boolean
- example: true
- measurement_unit:
- type: string
- example: ppm
- features:
- type: array
- example:
- - timer
- owner_user_id:
- type: string
- example: 592386d9ece9e403a2544657
- room_id:
- type: string
- example: 5985270044ed65484b7085a8
- DeleteRoomResponse:
- type: object
- required:
- - deleted
- properties:
- deleted:
- type: string
- example: 5985270044ed65484b7085a8
- DeleteRoomRequest:
- type: object
- required:
- - _id
- properties:
- _id:
- type: string
- example: 5985270044ed65484b7085a8
- GetReoomsResponse:
- type: array
- items:
- $ref: '#/components/schemas/RoomObject'
- RoomObject:
- type: object
- required:
- - _id
- - place
- - name
- properties:
- _id:
- type: string
- example: 5985270044ed65484b7085a8
- name:
- type: string
- example: My room
- place:
- $ref: '#/components/schemas/PlaceWithOwner'
- CreateRoomResponse:
- type: object
- required:
- - room
- properties:
- room:
- $ref: '#/components/schemas/RoomObject'
- DeletePlaceResponse:
- type: object
- required:
- - deleted
- properties:
- deleted:
- type: string
- example: 59851f1f44ed65484b708375
- DeleteAccessoryResponse:
- type: object
- required:
- - deleted
- properties:
- deleted:
- type: string
- example: 59851f1f44ed65484b708375
- DeleteAccessoryRequest:
- type: object
- required:
- - _id
- properties:
- _id:
- type: string
- example: 59851f1f44ed65484b708375
- DeletePlaceRequest:
- type: object
- required:
- - _id
- properties:
- _id:
- type: string
- example: 59851f1f44ed65484b708375
- CreateRoomRequest:
- type: object
- required:
- - name
- - place_id
- properties:
- name:
- type: string
- example: My first room
- place_id:
- type: string
- example: 598526b844ed65484b708596
- GetPlacesResponse:
- type: array
- items:
- $ref: '#/components/schemas/PlaceObject'
- GetAccessoriesResponse:
- type: array
- items:
- $ref: '#/components/schemas/CreateAccessoryResponse'
- PlaceWithOwner:
- type: object
- required:
- - _id
- - name
- - owner_user
- properties:
- _id:
- type: string
- example: 59851f1f44ed65484b708375
- name:
- type: string
- example: My new place
- owner_user:
- $ref: '#/components/schemas/UserObject'
- PlaceObject:
- type: object
- required:
- - _id
- - name
- properties:
- _id:
- type: string
- example: 59851f1f44ed65484b708375
- name:
- type: string
- example: My new place
- CreatePlaceResponse:
- type: object
- required:
- - place
- - owner_user
- properties:
- place:
- $ref: '#/components/schemas/PlaceObject'
- owner_user:
- $ref: '#/components/schemas/UserObject'
- CreatePlaceRequest:
- type: object
- required:
- - name
- properties:
- name:
- type: string
- example: My first place
- DeleteUserResponse:
- type: object
- required:
- - deleted
- properties:
- deleted:
- type: string
- example: 592386d9ece9e403a2544657
- DeleteUserRequest:
- type: object
- required:
- - _id
- properties:
- _id:
- type: string
- example: 592386d9ece9e403a2544657
- AuthResponse:
- type: object
- required:
- - user
- - auth
- properties:
- user:
- $ref: '#/components/schemas/UserObject'
- auth:
- $ref: '#/components/schemas/AuthObject'
- AuthObject:
- type: object
- required:
- - user_id
- - jwt
- - creation_date
- properties:
- user_id:
- type: string
- example: 592386d9ece9e403a2544657
- jwt:
- type: string
- example: 1501892164.01-592386d9ece9e403a2544657
- creation_date:
- example: 1501893040.761755
- type: number
- UserObject:
- type: object
- required:
- - name
- - username
- - _id
- properties:
- username:
- type: string
- example: admin
- _id:
- type: string
- example: 592386d9ece9e403a2544657
- name:
- type: string
- example: William hass
- AuthRequest:
- type: object
- required:
- - username
- - password
- properties:
- username:
- type: string
- example: admin
- password:
- type: string
- example: admin
- CreateUserRequest:
- type: object
- required:
- - username
- - name
- - password
- properties:
- username:
- example: admin
- type: string
- name:
- example: William Hass
- type: string
- password:
- example: admin
- type: string
- UserResponse:
- type: object
- required:
- - username
- - name
- - id
- properties:
- username:
- type: string
- example: admin
- name:
- type: string
- example: William Hass
- id:
- type: string
- example: 592386d9ece9e403a2544657
- DefaultError:
- type: object
- required:
- - message
- properties:
- message:
- type: string
- example: Message saying what happened
- DefaultErrorResponse:
- type: object
- properties:
- errors:
- type: array
- items:
- $ref: '#/components/schemas/DefaultError'
- parameters:
- accessory_id:
- name: _id
- in: query
- description: The id of an accessory
- required: false
- schema:
- type: string
- default: 59c591d2c23bab5fcc993d7a
- update_topic:
- name: update_topic
- in: query
- description: The update topic of an accessory
- required: false
- schema:
- type: string
- default: '60:01:94:29:96:9d'
- mac_id:
- name: mac_id
- in: query
- description: The mac id of the hardware
- required: false
- schema:
- type: string
- default: '60:01:94:29:96:9d'
- local_id:
- name: local_id
- in: query
- description: The local id of the hardware
- required: false
- schema:
- type: string
- default: any34
- place_id:
- name: place_id
- in: query
- description: The id of a place
- required: true
- schema:
- type: string
- default: 59851ef344ed65484b708363
- setup_session_id:
- name: setup_session_id
- in: query
- description: The id of the session to create a new accessory
- required: true
- schema:
- type: string
- default: 59853a1544ed65484b708b1c
- room_id:
- name: room_id
- in: query
- description: The id of a room
- required: true
- schema:
- type: string
- default: 5985270044ed65484b7085a8
- Jwt:
- name: Jwt
- in: header
- description: Authetication JWT
- required: true
- schema:
- type: string
- default: 1506351020.83-59c5878fc23bab5fcc993d72
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement