Asset Management Service – 过滤¶
所有带有参数 filter
的端点都支持*filterable*属性查询。不支持其他属性(如variables, aspects)的查询。
读取 assets 时,将过滤主租户和子租户的所有 assets。此外,还可在过滤器查询中提供以下一个或多个字段名称((其它所有未列出字段名称将被忽略):
assetId
tenantId
name
externalId
subTenant
timezone
twinType
deleted
parentId
typeId
fileId
hasType
(另请参见特殊字段)
不支持通配符。时间戳必须采用以下格式:2018-01-01T00:00:00.00Z
若过滤器无匹配项,响应结果将为空。
过滤函数¶
函数 eq
(等于)¶
{
"name":"MyMotor"
}
或
{
"name": {
"eq":"MyMotor"
}
}
函数 in
¶
函数 in
与 equals
非常相似,但它并非与一个值匹配,而是检查一个数组的值,并与其中的任何值匹配。
{
"name": {
"in": {
"value": ["MyMotor", "MyEngine"]
}
}
}
函数 endsWith
¶
{
"name": {
"endsWith":"Motor"
}
}
函数 startsWith
¶
{
"name": {
"startsWith":"My"
}
}
函数 contains
¶
{
"name": {
"contains": "yMot"
}
}
函数 before
¶
{
"deleted": {
"before":"2018-01-01T00:00:00.00Z"
}
}
函数 after
¶
{
"deleted": {
"after":"2018-01-01T00:00:00.00Z"
}
}
函数 between
¶
{
"deleted": {
"between": "[2018-01-01T00:00:00.00Z, 2018-01-31T00:00:00.00Z)"
}
}
过滤运算¶
运算 not
¶
{
"not": {
"name": {
"startsWith":"My"
}
}
}
或
{
"not": {
"name":"MyMotor"
}
}
运算 or
¶
{
"name": {
"or": [
{"eq":"MyMotor"},
{"endsWith":"Motor"}
]
}
}
或
{
"or": {
"deleted": {
"eq":null
},
"name": {
"startsWith":"My"
}
}
}
运算 and
¶
{
"name":"MyMotor",
"deleted":null
}
或
{
"and":{
"deleted": {
"eq":null
},
"name": {
"startsWith":"My"
}
}
}
特殊字段¶
字段 hasType
¶
使用 hasType
可过滤任何 asset type 及其后代。例如,type 为 core.motor
的所有 assets 或 asset type core.motor
派生的任何 type 的 assets。
{
"hasType": "core.motor"
}
说明
hasType
可匹配 type 层级中的任何 asset type,但字段 typeId
仅匹配给定 asset 的typeId,因此不返回后代。
Last update: March 3, 2020