Filtering items by an Extended Class or its Descendants
Copy
Use the isof_xclass(‘<class-name-or-id>’) function to filter an item collection by its assigned xClass:
GET http://host/server/odata/Part?$filter=isof_xclass(‘Bolt’)
AML:
<Item type="Part” action="get">
<Relationships>
<Item type="Part_xClass” action="get">
<related_id>
<Item type="xClass” action="get">
<name>Bolt</name>
</Item>
</related_id>
</Item>
</Relationships>
</Item>
Response:
HTTP/1.1 200 OK
{
"@odata.context": “http://host/server/odata/$metadata#Part”,
“value": [
{
“id": “048…3BC ",
“item_number": “Bolt”,
“itemtype": “4F1AC04A2B484F3ABA4E20DB63808A88"
… other Part item properties
}
… other Part items that classified by class ‘Bold’
]
}
If you pass the id string as a function argument, the class id is returned instead of the class name:
GET http://host/server/odata/Part?$filter=isof_xclass(‘F48…3BC’)
AML:
<Item type="Part” action="get">
<Relationships>
<Item type="Part_xClass” action="get">
<related_id>
<Item type="xClass” action="get">
<id>048…3BC</id>
</Item>
</related_id>
</Item>
</Relationships>
</Item>
Response:
HTTP/1.1 200 OK
{
"@odata.context": “http://host/server/odata/$metadata#Part”,
“value": [
{
“id": “048…3BC ",
“item_number": “Bolt”,
“itemtype": “4F1AC04A2B484F3ABA4E20DB63808A88"
… other Part item properties
}
… other Part items that classified by class (with ID='F48…3BC’)
]
}
Use the isof_xclassordescendants(‘<class-name-or-id>’) function to filter an item collection by its assigned xClass or descendants:
GET http://host/server/odata/Part?$filter=isof_xclassordescendants(‘Bolt’)
AML:
<Item type="Part” action="get">
<Relationships>
<Item type="Part_xClass” action="get">
<related_id>
<Item type="xClass” action="getxClassAndAllDescendants">
<name>Bolt</name>
</Item>
</related_id>
</Item>
</Relationships>
</Item>
Response:
HTTP/1.1 200 OK
{
"@odata.context": “http://host/server/odata/$metadata#Part”,
“value": [
{
“id": “048…3BC ",
“item_number": “Bolt”,
“itemtype": “4F1AC04A2B484F3ABA4E20DB63808A88"
… other Part item properties
}
… other Part items that classified by class class=’Bold’ or it subclasses
]
}