Table of Contents generated with DocToc
- WIZ Middleware Server
- Project Structure And Starting Instructions
- Remote Connection
- Remote Desktop
- API Endpoints
- API Endpoints: Root
- API Endpoints: GET Api Status
- API Endpoints: GET FabLab status base on FabLab Id
- API Endpoints: GET Order status base on Order Id
- API Endpoints: GET Slots base on FabLab Id DEPRECIATED
- API Endpoints: GET FabLab conf based on SerialNumber
- API Endpoints: GET ALL ids of ALL orders
- API Endpoints: GET the IDs of ALL orders for a FabLab based on FabLab SerialNumbers
- API Endpoints: GET oldest Order, aka Next Order, based on FabLab SerialNumber
- API Endpoints: POST new or updated Order with updated Status
- API Postman Collection
This is designed to explain how to use the Wiz Dev Server.
The architecture diagram of this system is presented below. Section 2). represents this group of API endpoints described in this document here. If you want to learn more about the others, see below.
┌─────────────────┐ ┌────────────────────────────────────┐ ┌─────────────────────────────┐
│ │ │ │ │ │
│ IRIS │ ───────► │ PrivateMiddleware │ ───────► │ RDIUP │
│ │ │ │ │ │
│ DigitalPlatform │ ◄─────── │ WIZ + DC │ ◄─────── │ Python │
│ │ │ │ │ │
└─────────────────┘ │ ┌────────────────────────────────┐ │ OR └─────────────────────────────┘
│ │ │ │ Fallback
1). │ │ Software Middleware w fallback │ │ ┌─────────────────────────────┐
│ │ │ │ ───────► │ │
│ │ PORT: 3000 │ │ │ MongoDb │
│ │ │ │ ◄─────── │ │
│ └────────────────────────────────┘ │ └─────────────────────────────┘
│ │
──────────────────────── │ ────────────────────────────────── │ ────────────────────────────────────────
│ │
2). │ │
│ │
┌─────────────────┐ │ ┌────────────────────────────────┐ │ ┌─────────────────────────────┐
│ │ │ │ │ │ │ │
│ IRIS │ ───────► │ │ Hardware Middleware Prime OLD │ │ │ Static Backend │
│ │ │ │ │ │ ◄─────── │ │
│ DigitalPlatform │ ◄─────── │ │ PORT: 3001 │ │ │ Read-Only Data (expressJs) │
│ │ │ │ │ │ │ │
└─────────────────┘ │ └────────────────────────────────┘ │ └─────────────────────────────┘
│ │
3). │ │
│ │
┌─────────────────┐ │ ┌────────────────────────────────┐ │
│ │ │ │ │ │ ┌─────────────────────────────┐
│ CODY │ ───────► │ │ Hardware Middleware (Virtual) │ │ ───────► │ │
│ │ │ │ │ │ │ MongoDb │
│ HardwareBackEnd │ ◄─────── │ │ PORT: 3003 │ │ ◄─────── │ │
│ │ │ │ │ │ └─────────────────────────────┘
└─────────────────┘ │ └────────────────────────────────┘ │
│ │
└────────────────────────────────────┘
To read the full documentation for all the other sections see below:
For Section 1)., use the link: https://gist.github.com/andysign/d5f546c38eb559510ed1b0c4f8b7992e
For Section 3)., use the link: https://gist.github.com/andysign/6d38c10bdfca83a2500ac495ad3c79f7
This section describes the folder structure and how to start the project.
The project can be found in:
/c/work/diy4u-hardware
Note: You can use Power Shell, Command Prompt or Git Bash to access it.
Check Task Manager and make sure there is no node.exe process running. After that navigate to /c/work/diy4u-hardware
in bash and type:
npm start
Remote connections are also available for uploading or downloading code.
- Port:
21
- Username:
admin
- Pwd:
crC5mtU9AdQ3JP!
By default all files uploaded trough the ftp will go in:
C:\inetpub\vhosts\trusting-sinoussi.207-244-228-246.plesk.page\httpdocs\diy4u-hardware\
Every static html file uploaded here will be accessible using the link below:
http://207.244.228.246/plesk-site-preview/trusting-sinoussi.207-244-228-246.plesk.page/
No SSH connection!
The main server can be controlled remotely using the following credentials.
- IP:
207.244.228.246
- Username
Administrator
- Password:
crC5mtU9AdQ3JP
- Username:
diy4you1
- New Password:
diy4u!
- Username:
diy4you2
- New Password:
diy4u!
- Username:
diy4you3
- New Password:
diy4u!
All current endpoints should contain the version ( v1 ) in the path.
- Endpoint:
/
OR/api/v1/
curl -X GET 'http://207.244.228.246:3001/'; echo
- Expected Result:
{ "result": "Demo Hardware Middleware API." }
- Endpoint:
/api/v1/status
curl -X GET 'http://207.244.228.246:3001/api/v1/status'; echo
- Expected Result:
{"result":"Middleware is up and running."}
- Endpoint:
/api/v1/fablab-status/:id
curl -X GET 'http://207.244.228.246:3001/api/v1/fablab-status/1'; echo
- Expected Result:
{ "id": "1", "status": "READY / NOT_READY" }
- Endpoint:
/api/v1/order-status/:id
curl -X GET 'http://207.244.228.246:3001/api/v1/order-status/1'; echo
- Expected Result:
{"id":"1","status":"WAITING / FINISHED"}
- Endpoint DEPRECIATED:
/api/v1/fablab/:id/slots
curl -X GET 'http://207.244.228.246:3001/api/v1/fablab/101/slots'; echo
- Expected Result:
{
"id": "101",
"slots": [
{ "id": 1, "serialNo": 1, "modelWidth": 1 },
{ "id": 2, "serialNo": 2, "modelWidth": 1 }
]
}
- Endpoint:
/api/v1/fablab-conf-by-serial-no/:sn
curl -X GET 'http://207.244.228.246:3001/api/v1/fablab-conf-by-serial-no/XY123'; echo
- Expected Result:
{ "serialNo": "XY123",
"modules": [
{
"serialNo": "ABCD1234",
"position": 1,
"moduleWidth": 1,
"subModules": [ { "serialNo": "11HXU2QT", "subModuleType": 1001 } ]
}
]
}
- Endpoint:
/api/v1/all-order-ids
curl -X GET 'http://207.244.228.246:3001/api/v1/all-order-ids'; echo
- Expected Result:
[ { "orderId": 101, "forFablabSn": "JSDAHFJSAHFKADF" },
{ "orderId": 102, "forFablabSn": "SAHFKJSDAHFJADF" },
{ "orderId": 103, "forFablabSn": "HFKJSAADFDAHFJS" } ]
- Endpoint:
/api/v1/fablab-order-ids-by-serial-no/:sn
curl -X GET 'http://207.244.228.246:3001/api/v1/fablab-order-ids-by-serial-no/ABC123'; echo
- Expected Results:
[ { "orderId":101, "forFablabSn": "ABC123" } ]
- Endpoint:
/api/v1/fablab-next-order-id-by-serial-no/:sn
curl -X GET 'http://207.244.228.246:3001/api/v1/fablab-next-order-id-by-serial-no/XYZ123'; echo
- Order Details:
{ "orderId": 101, "forFablabSn": "XYZ123" }
---
### API Endpoints: GET Order by OrderId
* Endpoint: `/api/v1/fablab-order-by-id/:id`
```sh
curl -X GET 'http://207.244.228.246:3001/api/v1/fablab-order-by-id/101'; echo
- Order Details:
{ "order": {
"date": "2022-05-03T08:48:53.577Z",
"status": "PENDING",
"forFablabSn": "XYZ123",
"operations": [
{ "index": 0, "moduleSerialNo": "MNP456",
"submoduleSerialNo": "ABC777", "functionId": 13,
"parameters": [
{ "name": "speed", "value": 11.2, "type": "float" },
{ "name": "time", "value": 1000, "type": "float" } ],
"HMIInfo": "Dispensing an int num of Units of salt"
}
]
}
}
- Endpoint:
/api/v1/fablab-order-by-id
- Note: If body is empty ( as body is in '{}' ) will call will use a hard-coded body
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"order": {
"id": 101, "date": "2022-04-06T11:41:08.361Z",
"status": "IN_PROGRESS", "forFablabSn": "XYZ123",
"operations": [ {
"index": 0, "moduleSerialNo": "DFE123",
"submoduleSerialNo": "ABC987", "functionId": 11,
"parameters": [ { "name": "revolutions", "value": 2, "type": "integer" } ],
"HMIInfo": "Dispensing an int num of Units of salt"
} ]
}
}' 'http://207.244.228.246:3001/api/v1/fablab-order-by-id' ; echo
- Expected Result: Same as the data object above
{
"info": {
"_postman_id": "3e16398a-ae2f-4dd7-9312-f04f3349fae0",
"name": "DIY4U",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Root",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://207.244.228.246:3001/",
"protocol": "http",
"host": [
"207",
"244",
"228",
"246"
],
"port": "3001",
"path": [
""
]
}
},
"response": []
},
{
"name": "Api Status",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://207.244.228.246:3001/api/v1/status",
"protocol": "http",
"host": [
"207",
"244",
"228",
"246"
],
"port": "3001",
"path": [
"api",
"v1",
"status"
]
}
},
"response": []
},
{
"name": "FabLab status base on FabLab Id",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://207.244.228.246:3001/api/v1/fablab-status/1",
"protocol": "http",
"host": [
"207",
"244",
"228",
"246"
],
"port": "3001",
"path": [
"api",
"v1",
"fablab-status",
"1"
]
}
},
"response": []
},
{
"name": "Slots base on FabLab Id",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://207.244.228.246:3001/api/v1/fablab/101/slots",
"protocol": "http",
"host": [
"207",
"244",
"228",
"246"
],
"port": "3001",
"path": [
"api",
"v1",
"fablab",
"101",
"slots"
]
}
},
"response": []
},
{
"name": "Order status base on Order Id",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://207.244.228.246:3001/api/v1/order-status/1",
"protocol": "http",
"host": [
"207",
"244",
"228",
"246"
],
"port": "3001",
"path": [
"api",
"v1",
"order-status",
"1"
]
}
},
"response": []
},
{
"name": "FabLab conf based on serial number",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://207.244.228.246:3001/api/v1/fablab-conf-by-serial-no/XY123",
"protocol": "http",
"host": [
"207",
"244",
"228",
"246"
],
"port": "3001",
"path": [
"api",
"v1",
"fablab-conf-by-serial-no",
"XY123"
]
}
},
"response": []
},
{
"name": "FabLab order IDs based on FabLab serial number",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://207.244.228.246:3001/api/v1/all-order-ids",
"protocol": "http",
"host": [
"207",
"244",
"228",
"246"
],
"port": "3001",
"path": [
"api",
"v1",
"all-order-ids"
]
}
},
"response": []
},
{
"name": "oldest order ( next order ) based on FabLab serial number",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://207.244.228.246:3001/api/v1/fablab-next-order-id-by-serial-no/XYZ123",
"protocol": "http",
"host": [
"207",
"244",
"228",
"246"
],
"port": "3001",
"path": [
"api",
"v1",
"fablab-next-order-id-by-serial-no",
"XYZ123"
]
}
},
"response": []
},
{
"name": "new or updated order with updated status",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"order\": {\r\n \"id\": 101, \"date\": \"2022-04-06T11:41:08.361Z\",\r\n \"status\": \"COMPLETED\", \"forFablabSn\": \"XYZ123\",\r\n \"operations\": [ {\r\n \"index\": 0, \"moduleSerialNo\": \"DFE125\",\r\n \"submoduleSerialNo\": \"ABC987\", \"functionId\": 11,\r\n \"parameters\": [ { \"name\": \"revolutions\", \"value\": 2, \"type\": \"integer\" } ],\r\n \"HMIInfo\": \"Dispensing an int num of Units of salt\"\r\n } ]\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://207.244.228.246:3001/api/v1/fablab-order-by-id",
"protocol": "http",
"host": [
"207",
"244",
"228",
"246"
],
"port": "3001",
"path": [
"api",
"v1",
"fablab-order-by-id"
]
}
},
"response": []
}
]
}