The latest version of TMF630 (v17.5.0) still doesn't provide any guidance on the problem of querying on characteristic values.
While it is clear how to specify complex types using dot notation ("objectName.fieldName") it is less clear, and not explicitly mentioned, how to handle arrays which is a common use case.
Using TMF635 Usage Management as an example if we wanted to query the resources where a particular characteristic has a particular value we might try:
/usageManagement/v1/usage?usageCharacteristic.name=poolNumber;usageCharacteristic.value=1
The problem here is that this would technically match any resource with a characteristic of poolNumber and any characteristic with value 1.
What we need is a syntax which would group name and value such as possibly:
/usageManagement/v1/usage?usageCharacteristic={name=originatingNumber;value=676123456789}&usageCharacteristic={name=duration;value=20}
... where the above would match usage records where the originatingNumber characteristic value was 676123456789 and the duration value was 20.
Has anyone considered this issue? Any other suggestions on syntax?
------------------------------
Vance Shipley
SigScale Global Inc.
------------------------------
Original Message:
Sent: 07-21-2017 07:01
From: Vance Shipley
Subject: Query Complex Types: Array
In the section on query and filtering TMF630 REST Guidelines states:
Complex attribute value type may be filtered using a "." notation.
[{attributeName.attributeName}={attributeValue}&*]
So given a collection of objects:
[
...
{
"id": 123,
"foo":
{
"bar": 42
}
}
...
]
We can select it using: ?foo.bar=42
Currently we are using TMF635 Usage Management where the attribute usageCharacteristic
is an array of name/value objects:
{
"id": 456,
...
"usageCharacteristic":
[
...
{
"name": "poolNumber",
"value": 1
}
...
]
}
In this use case we always want to query and filter using the usageCharacteristic however there is no obvious way to do this!
What do you suggest?
------------------------------
Vance Shipley
SigScale Global Inc.
------------------------------