Accessing Node Space
Generic Nodes
To manage the node space, use the following URLs:
nodes
accessing the whole node spacenodes/node
accessing a specific node in the node spacenodes/relation
accessing binary relationsnodes/group
accessing group relations
Following HTTP methods are supported:
GET
gets information or content of the nodesPOST
creates new nodes or adds nodes to groupsPATCH
sets properties to nodes or changes other behaviorsDELETE
removes nodes from node space or groups
Creating Nodes
Creates nodes directly from a schema XML given to the web service. This function allows to create nodes from:
- Object schema
- Workflow schema
- Processing networks
HTTP Method | POST |
HTTP Url: | /nodes |
HTTP Query-Parameter: | - |
Request Content-Type | text/xml or application/xml; text/json or application/json |
Request Body | Schema |
Response Content-Type | text/xml or text/json |
Response Content | List of created objects |
Hint: the body of the request is s schema in xml, regardless of the request content-type. According to content-type, the body or the response is sent.
Example:
POST http://localhost:8081/nodes
Request Body:
<?xml version="1.0" encoding="utf-8" ?>
<HumanOS.Schema type="ObjectSchema" syntaxVersion="1.0">
<Name>Portmatching Objects</Name>
<Id>{B2344E8D-581B-44EC-BACE-38B5697E9747}</Id>
<ControlLevel>0</ControlLevel>
<ObjectInfo>
<Name>MyPortMatchingRule</Name>
<TypeName>HumanOS.Kernel.DataModel.Rules.TPortMatchingRule, HumanOS.Kernel</TypeName>
</ObjectInfo>
</HumanOS.Schema>
Response Body:
<HumanOS.Stream>
<NodeList>
<Node id="256b9148-9cf1-4bfc-8d22-8625ecb559fb" name="MYPortMatchingRule" />
</NodeList>
</HumanOS.Stream>
Delete All Nodes
Removes all nodes from the node space.
HTTP Method: | DELETE |
HTTP Url: | /nodes |
HTTP Query-Parameter: | - |
Request Content-Type | text/xml |
Request Body | - |
Response Content-Type | text/text |
Response Content | "OK" |
Example:
DELETE http://localhost:8081/nodes
Delete Specific Node
Removes a specific node from the node space.
HTTP Method: | DELETE |
HTTP Url: | /nodes/node |
HTTP Query-Parameter: | id : global id as System.Guid |
Request Content-Type | text/xml |
Request Body | - |
Response Content-Type | text/text |
Response Content | "OK" |
Example:
DELETE http://localhost:8081/nodes/node?id=8d67b876-3062-47a8-97b1-25f92d863d97
Get All Nodes
Gets all nodes from the node space. An xml list of nodes is returned.
HTTP Method: | GET |
HTTP Url: | /nodes |
HTTP Query-Parameter: | - |
Request Content-Type | text/xml ; text/json |
Request Body | - |
Response Content-Type | text/xml or text/json |
Response Body | List of created objects |
Example:
GET http://localhost:8081/nodes
Response Body:
<HumanOS.Stream>
<NodeList>
<Node id="e5e2e9c8-a35f-431e-8df3-6d792fe5abdf" name="CorrelationRule" />
<Node id="7a52c82f-f7c4-4024-8620-4204d952374f" name="PortMatchingInstancingRule" />
<Node id="f6a2be03-bcfb-43f7-a0f4-995f804763a3" name="BindDevicesToMtConnectRule" />
<Node id="f9a4300a-654b-42cf-9f54-f866184b7352" name="UnbindDevicesFromMtConnect Rule" />
…
</NodeList>
</HumanOS.Stream>
Get a Specific Node
Gets a node by global-id.
HTTP Method | GET |
HTTP Url: | nodes/node |
HTTP Query-Parameter: | id : global id as System.Guid |
Request Content-Type | text/xml ; text/json |
Request Body | - |
Response Content-Type | text/xml or text/json |
Response Body | Serialized .net object |
Example:
GET http://localhost:8081/nodes/node?id=8d67b876-3062-47a8-97b1-25f92d863d97
Response Body:
<HumanOS.Stream>
<Node>
<Id>8d67b876-3062-47a8-97b1-25f92d863d97</Id>
<Name>Reset</Name>
<Property>
<Name>DeviceId</Name>
<DataType>System.Guid</DataType>
<Value>ece37fdf-4862-4543-af23-48ffdb8203c7</Value>
</Property>
</Node>
</HumanOS.Stream>
Set a Property Value
Sets a property value to a node.
HTTP Method | PATCH |
HTTP Url: | nodes/node |
HTTP Query-Parameter: | id : global id as System.Guid; name : property name; value : new value of the property |
Request Content-Type | text/text |
Request Body | - |
Response Content-Type | text/text |
Response Content | “OK” |
Example:
PATCH http://localhost:8081/nodes/node?id=8d67b876-3062-47a8-97b1-25f92d863d97&name=MappedName&value=MyDataNode
Get a Specific Enum Type
Some commands or entity classes use enumerations instead of integer values.
This REST call returns a specific enumeration type. Use the enum-names as values for entities or command arguments.
HTTP Method | PATCH |
HTTP Url: | nodes/enum |
HTTP Query-Parameter: | name : enum typename. |
Request Content-Type | text/xml ; text/json |
Request Body | - |
Response Content-Type | text/xml or text/json |
Response Content | Serialized enumeration names and values |
Type names are typically given with the namespace, and optionally followed by the assembly name separated with ","-sign
Example:
GET http://localhost:8081/nodes/enum?name=HumanOS.Kernel.DataModel.EDataClass,HumanOS.Kernel.Base`
Response:
<HumanOS.Stream>
<EnumType>
<Name>HumanOS.Kernel.DataModel.EDataClass, HumanOS.Kernel.Base</Name>
<Item>
<Name>Event</Name>
<Value>0</Value>
</Item>
<Item>
<Name>Stream</Name>
<Value>1</Value>
</Item>
</EnumType>
</HumanOS.Stream>
Binary Relations
Binary relation is a link between two nodes.
Create a Binary Relation
Creates a binary relation.
HTTP Method | POST |
HTTP Url: | nodes/relation |
HTTP Query-Parameter: | name : name of relation; node1 : id of node 1; node2 : id of node 2; role1 : role of node 1 (optional); role2 : role of node 2 (optional) |
Request Content-Type | text/xml ; text/json |
Request Body | - |
Response Content-Type | text/xml ; text/json |
Response Content | Id of relation |
Example:
POST http://localhost:8081/nodes/relation?name=Relation1&node1=8d67b876-3062-47a8-97b1-25f92d863d97&node2=7eefb87c-6152-89a9-9ccb-2f9924133acc
Response Body:
<HumanOS.Stream>
<NodeList>
<Node id="f9a4300a-654b-42cf-9f54-f866184b7352" name="Relation1" />
</NodeList>
</HumanOS.Stream>
Removes a Relation
Removes an existing relation. Use the /nodes/node URL to remove the relation (see Delete Specific Node).
Example:
DELETE http://localhost:8081/nodes/node?id=f9a4300a-654b-42cf-9f54-f866184b7352
List Nodes of a Relation
Gets the nodes and roles of a binary relation.
HTTP Method | GET |
HTTP Url: | nodes/relation |
HTTP Query-Parameter: | id : group id as System.Guid |
Request Content-Type | text/xml ; text/json |
Request Body | - |
Response Content-Type | text/xml ; text/json |
Response Content | List of two nodes in the relation |
Example:
GET http://localhost:8081/nodes/relation?id=f9a4300a-654b-42cf-9f54-f866184b7352
Response Body:
<HumanOS.Stream>
<BinaryRelation>
<Node id="e5e2e9c8-a35f-431e-8df3-6d792fe5abdf" role="Object1" />
<Node id="7a52c82f-f7c4-4024-8620-4204d952374f" role="Object2" />
</BinaryRelation>
</HumanOS.Stream>
Group-Relation
Describes the functions to manage group relations.
Creates a Group Relation
Creates a group relation
HTTP Method | POST |
HTTP Url: | odes/group |
HTTP Query-Parameter: | name : name of the group |
Request Content-Type | text/xml ; text/json |
Request Body | List of nodes ids to be added (optional) |
Response Content-Type | text/xml ; text/json |
Response Content | Id of group |
Example:
POST http://localhost:8081/nodes/group?name=Group1
Request Body (Optional):
<HumanOS.Stream>
<GroupRelation>
<Node id="e5e2e9c8-a35f-431e-8df3-6d792fe5abdf"/>
<Node id="7a52c82f-f7c4-4024-8620-4204d952374f"/>
<Node id="f6a2be03-bcfb-43f7-a0f4-995f804763a3"/>
</GroupRelation>
</HumanOS.Stream>
Response Body:
<HumanOS.Stream>
<NodeList>
<Node id="f9a4300a-654b-42cf-9f54-f866184b7352" name="Group1" />
</NodeList>
</HumanOS.Stream>
Add Nodes to a Group
Adds nodes to a group.
HTTP Method | PATCH |
HTTP Url: | nodes/group |
HTTP Query-Parameter: | id : group id as System.Guid |
Request Content-Type | text/xml ; text/json |
Request Body | List of nodes ids to be added |
Response Content-Type | text/text |
Response Content | “OK” |
Example:
PATCH http://localhost:8081/nodes/group?id=f9a4300a-654b-42cf-9f54-f866184b7352
Request Body:
<HumanOS.Stream>
<GroupRelation>
<Node id="e5e2e9c8-a35f-431e-8df3-6d792fe5abdf"/>
<Node id="7a52c82f-f7c4-4024-8620-4204d952374f"/>
<Node id="f6a2be03-bcfb-43f7-a0f4-995f804763a3"/>
</GroupRelation>
</HumanOS.Stream>
Removes Nodes from a Group
Removes nodes from a group.
HTTP Method | DELETE |
HTTP Url: | nodes/group |
HTTP Query-Parameter: | id : group id as System.Guid |
Request Content-Type | text/xml ; text/json |
Request Body | List of nodes ids to be removed |
Response Content-Type | text/text |
Response Content | “OK” |
Example:
DELETE http://localhost:8081/nodes/group?id=f9a4300a-654b-42cf-9f54-f866184b7352
Request Body:
<HumanOS.Stream>
<GroupRelation>
<Node id="e5e2e9c8-a35f-431e-8df3-6d792fe5abdf"/>
<Node id="7a52c82f-f7c4-4024-8620-4204d952374f"/>
<Node id="f6a2be03-bcfb-43f7-a0f4-995f804763a3"/>
</GroupRelation>
</HumanOS.Stream>
List Nodes of a Group
Lists nodes within a specific group.
HTTP Method | GET |
HTTP Url: | nodes/group |
HTTP Query-Parameter: | id : group id as System.Guid |
Request Content-Type | text/xml ; text/json |
Request Body | - |
Response Content-Type | text/xml ; text/json |
Response Content | List of nodes in the group |
Example:
GET http://localhost:8081/nodes/group?id=f9a4300a-654b-42cf-9f54-f866184b7352
Response Body:
<HumanOS.Stream>
<GroupRelation>
<Node id="e5e2e9c8-a35f-431e-8df3-6d792fe5abdf" name="Object1" />
<Node id="7a52c82f-f7c4-4024-8620-4204d952374f" name="Object2" />
<Node id="f6a2be03-bcfb-43f7-a0f4-995f804763a3" name="Object3" />
</GroupRelation>
</HumanOS.Stream>