Project logo

Api2

REST API pre senzorický systém nSoric.


REST API pre merací systém nSoric

Konfiguračný súbor

Súbor server/goAPI/config.json.local premenuj na config.json a nastav správne parametre.

Nastavenie projektu

  • go get github.com/gorilla/mux
  • go get github.com/dgrijalva/jwt-go
  • go get github.com/go-sql-driver/mysql
  • go get github.com/jinzhu/gorm
  • go get github.com/gorilla/handlers
  • go get github.com/rs/cors
  • go run main.go

Opis princípu API - login, manage

Model senzorického systému sa skladá z 2 základných častí:

  • model používateľov a ich oprávnení (AUTH API)
  • model samotnej aplikácie (MANAGE API)

Model používateľov a nastavení existuje vždy práve jeden. Obsahuje záznamy pre všetkých používateľov (z roznych inštálácií) a ich pridelených aplikácií. V tomto modely sú uložené informácie o všetkých inštaláciách sysnzorického systému. Každá inštalácia senzorického systému má svoju pridelenú databázu, kde sú ukladané nemerané hodnoty.

API v2 endpoints

AUTH API

base url: http://login.nsoric.com/nsoric/auth/

In all requests is need to authentificate with JWT token.

POST requests

  • login/ - login to system (with login and poassword)
  • user/ - create a new user (in login DB and application DB)

PUT requests

  • user/ - modify user

DELETE requests

  • user/{login} - delete user with given login. Note: delete user in Login and Application database

GET requests

  • user/{login} - get user info

MANAGE API

base url: http://{app}.nsoric.com/{endpoint}/manage/

POST requests

  • login/ - automatic login to application
  • port/ - list of all ports
  • port/{id} - selected port (by id)
  • user/ - create APP user, also create new user in AUTH API database
  • groupView/ - add groupArea record (add user tp area)

GET requests

  • user/{login} - get info about user (areas, sectors)
  • sector/{sectorID} - get info about sector (list of sensors)
  • sector/{sectorID}/values/ - get measured sensor values from selected sector. Header parameter 'interval'
  • sector/{sectorID}/last-values/ - get last measured values from sensors in selected sector.
  • sensor/ - list all sensors (with details) *
  • sensor/{sid} - sensor detail *
  • area - get all areas

PUT requests

  • port/ - modify communication port
  • sensor/{sid} - modify sensor *
  • user/{login} - modify application user

DELETE requests

  • port/ - delete communication port
  • user/{login} - delete application user, alse delete user in AUTH API database
  • groupView/{userId}/{appId} - delete groupArea record (remove user from area)

| requres user rights: manage

STORE API

base url: http://{app}.nsoric.com/{endpoint}/store/

POST requests

  • value/ - store measured valut to application database

GET requests

  • config/ - get information about application confguration

MIT License Copyright (c)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Contributors 2

Juraj Ďuďák 94.16%

Matus Ravas 5.84%


Links

Project is private. You have to Login !


Languages

  • Go 91.15%
  • TSQL 7.12%
  • Shell 1.72%

  • Last update

    29.11.2021 20:58:56

    Created at

    22.09.2019