Create Virtual Hub
This endpoint facilitates the creation of a new virtual hub within an organisation. The request allows for defining key attributes such as the virtual hub’s unique identifier, name, description, and associated organisation ID. Additionally, the request can specify connected ports, mapping the virtual hub to physical hubs by linking hub IDs with corresponding port IDs. This structured approach ensures clear visibility into the virtual hub’s configuration, enabling efficient management of port assignments and network connectivity. By creating a virtual hub, organisations can optimise their infrastructure, streamline device connections, and enhance network oversight.
Syntax: see 'CCall Structure
Type = 'POST'
'https://connect.cambrionix.com/api/hardware/v1/virtual-hubs/' |
In the data section of the request, include the information you wish to add, formatted as shown below.
{ "name": "virtual-hub-name", "description": "virtual-hub-description", "ports": { "virtual-hub-port": { "hub": { "id": "hub-serial" }, "port": { "id": hub-port } } } |
Output | Description |
---|---|
virtual-hub-name | This is the name of the virtual hub |
virtual-hub-description | This is the description of the virtual hub |
virtual-hub-port | This is the port number of the virtual hub |
hub-serial | This is the serial number of the hub |
hub-port | This is the port number of the hub |
Returns:
{ "created": { "time": time }, "updated": { "time": time }, "id": "virtual-hub-id", "organization": { "id": "organisation-id" }, "name": "virtual-hub-name", "description": "virtual-hub-description", "ports": { "virtual-hub-port": { "hub": { "id": "hub-serial" }, "port": { "id": hub-port } } } |
Output | Description |
---|---|
time | The hub time, shown as an integer in ms |
virtual-hub-id | This is the id of the virtual hub as a unique 128-bit number |
organisation-id | This is the id of the organisation as a unique 128-bit number |
virtual-hub-name | This is the name of the virtual hub |
virtual-hub-description | This is the description of the virtual hub |
virtual-hub-port | This is theport number of the virtual hub |
hub-serial | This is the serial number of the hub |
hub-port | This is the port number of the hub |
Example
curl -X 'POST' \
'https://connect.cambrionix.com/api/hardware/v1/virtual-hubs/00000000-0000-0000-0000-000000000000' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJSUzI1RTSpd5DmuJd2PGWm_s8Wfzl-DTdsi-rz-PcYMUyiNtDteuTvRDA' \
-H 'Content-Type: application/json' \
-d ' "name": "hub 1",
"description": "aaa",
"ports": {
"1": {
"hub": {
"id": "0000006567CDF436"
},
"port": {
"id": 2
}
},
"2": {
"hub": {
"id": "0000006567CDF436"
},
"port": {
"id": 5
}
},
"3": {
"hub": {
"id": "0000006567CDF436"
},
"port": {
"id": 8
}
},
"4": {
"hub": {
"id": "DJ00B475"
},
"port": {
"id": 1
}
}
}
}
}
}'
Returns
{
"result": [
{
"created": {
"time": 1724248462488
},
"updated": {
"time": 1724248462488
},
"id": "00f7543a-d6ef-4059-8691-9ce54a9f12e1",
"organization": {
"id": "dafc70d5-a4c8-42a3-ad8d-a8ccb5fa313f"
},
"name": "hub 1",
"description": "aaa",
"ports": {
"1": {
"hub": {
"id": "0000006567CDF436"
},
"port": {
"id": 2
}
},
"2": {
"hub": {
"id": "0000006567CDF436"
},
"port": {
"id": 5
}
},
"3": {
"hub": {
"id": "0000006567CDF436"
},
"port": {
"id": 8
}
},
"4": {
"hub": {
"id": "DJ00B475"
},
"port": {
"id": 1
}
}
}
}
}
}
Errors
If there is an error in the API method then JSON-RPC Error Object a will be returned