Manager node for the Distributed and Decentralized IoT Platform
- Fetch the IFPS hash for a given device ID
[PUT] /ifps-hash/{device_id}
Request body:
{
"email": "<email>",
"password": "<password>"
}Response:
- For successfully authenticated user - 200 OK with IFPS hash
{
"ipfsHash": ["<IFPS hash>", ...]
}- For unsuccessfully authenticated user - 401 Unauthorized
-
Note: All requests will contain JWT in the Bearer token header
-
Register user
[POST] /users
Request body:
{
"email": "<email>",
"password": "<password>"
}Response:
200 OK for successful registration
400 Bad Request for failed registration
- Sign in user
[PUT] /users/signin
Request body:
{
"email": "<email>",
"password": "<password>"
}Response:
200 OK for successful sign in
Response body:
{
"token": "<jwt>"
}401 Unauthorized for failed sign in
- Register IoT device
[POST] /devices
Request body:
{
"id": "<id>",
"name": "<name>",
"owner": "<owner>",
"region": "<region>"
}Response:
200 OK for successful registration
{
"deviceID": "<device_id>",
"apiKey": "<api_key>"
}400 Bad Request for failed registration
- Delete IoT device
[DELETE] /devices/<id>
Response:
200 OK for successful deletion
400 Bad Request for failed deletion
- Create access policy
[POST] /policies
Request body:
{
"device_id": "<device_id>",
"accessing_device_id": ["<accessing_device_id>", ...],
"accessing_user_id": ["<accessing_user_id>", ...],
}Response:
200 OK for successful creation
400 Bad Request for failed creation
- Delete access policy
[DELETE] /policies/device/<device-id>/accessing-device/<accessor-id>
Response:
200 OK for successful deletion
400 Bad Request for failed deletion
- Register client
[POST] /clients
{
"email": "<email>",
"password": "<password>",
}Response:
200 OK for successful registration
400 Bad Request for failed registration
- Get list of devices
[GET] /devices
Response:
200 OK for successful retrieval
Response body:
{
"devices": [
{
"id": "<id>",
"name": "<name>",
"owner": "<owner>",
"region": "<region>",
"ipfs": ["<ipfs_hash>", ...]
"updated_at": "<timestamp>"
},
...
]
}400 Bad Request for failed retrieval
- Get list of devices
[GET] /policies
Response:
200 OK for successful retrieval
Response body:
{
"policies": [
{
"id": "<id>",
"name": "<name>",
"authorized_devices": [
"<device_id>",
],
"authorized_users": [
"<user_id>",
]
},
...
]
}400 Bad Request for failed retrieval
- Update IPFS hash
[PUT] /iot/ifps-hash
Request body:
{
"device_id": "<device id>",
"api_key": "<api key>",
"ipfs_hash": ["<IPFS hash>", ...]
}Response:
200 OK for successful update
403 Forbidden for failed update due to device not allowed to update IPFS hash
- Fetch device IPFS hash for other IoT device based on access
[PUT] iot/data-access
{
"device-id": "<device id>",
"api-key": "<api key>"
}Response:
200 OK for successful retrieval with IPFS hash
{
"ipfs-hash": "<IFPS hash>"
}401 Unauthorized if device not allowed access
- Add the path to your local fabric-samples directory in FabricService class ("parentPath")
- Navigate to the fabric-gateway-app folder. Build the source code and run the app from this folder.
- Command to build : "mvn clean install"
- Command to run app : "java -jar target/fabric-gateway-app-1.0-SNAPSHOT.jar"