A sample project: managing gateways - master devices that control multiple peripheral devices
REST service (JSON/HTTP) for storing information about gateways and their associated devices.
- Programming language: C#
- Framework: Asp.Net Core 2.2.0
- Database: MSSQLLocalDB
- Automated build: AppVeyor
Instructions (Manual):
- Open provided 'WebApiGateways.sln' file with Visual Studio
- Resolve any dependency issue
- Go to 'Tools/NuGet Package Manager/Package Manager Console', write and execute: Update-database
- Go to 'View/SQL Server Object Explorer' and run provideded 'SQL Script to Import Test Data.sql' file on 'WebApiGatewaysM3DB' database
- Press CTRL + F5
- Done
See ENDPOINTS...
Unit Tests for the cases in description
For Gateways controller:
- Get All Gateways
- Get A Gateway By Non Existing Serial Number
- Get A Gateway By Existing Serial Number
- Add A Gateway Bad Ip Address
- Add A Gateway Good IpAddress
For Devices controller:
- Get All Devices
- Get A Device By Non Existing UID
- Get A Devices By Existing UID
- Get All Devices Of A Gateway By Its Serial Number
- Add A Device
- Add A Device To A Full Gateway
- Delete A Devices By Its UID
Instructions (Manual):
- Open provided 'WebApiGateways.sln' file with Visual Studio
- Resolve any dependency issue
- Go to 'Test/Windows/Test Explorer' and click on: Run All
- Done
A React Basic UI for the WebApi Gateway solution.
GET https://{host}:{port}/api/gateways
GET https://{host}:{port}/api/gateways/{serialNumber}
POST https://{host}:{port}/api/gateways
- Ex: POST https://localhost:44306/api/gateways
body: {
"SerialNumber":"gw-006", // a unique serial number (string)
"Name": "GateWay 6", // human-readable name (string)
"IpAddress":"10.0.0.6" // IPv4 address (string)
}
GET https://{host}:{port}/api/devices
GET https://{host}:{port}/api/devices/{uid}
GET https://{host}:{port}/api/devices/gw/{serialNumber}
POST https://{host}:{port}/api/devices/{serialNumber}
- Ex: POST https://localhost:44306/api/devices/gw-006
body: {
"UID": 21, // a UID (number)
"Vendor": "Device Vendor", // vendor name (string)
"Date": "2021-02-14 22:43:00", // date created (date)
"Status": true // status Online/Offline (bool)
}
POST https://{host}:{port}/api/devices/{serialNumber}/{uid}
DELETE https://{host}:{port}/api/devices/{serialNumber}/{uid}
- Ex: DELETE https://localhost:44306/api/devices/gw-001/1
DELETE https://{host}:{port}/api/devices/{uid}
- Ex: DELETE https://localhost:44306/api/devices/1