FIWARE Orion:如何将 creDate 和 modDate 添加到 orion 的通知中?
FIWARE Orion: how to add creDate and modDate to notification from orion?
我正在尝试使用 subscribeContext 和通知(参见 link https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv1/index.html#ngsi10-standard-operations)
与mongodb一样,有creDate和modDate属性,但在notifyContextRequest payload中没有这两个属性。
是否可以将 creDate 和 modDate 属性包含到 notifyContextRequest 负载中?
有没有办法使用 Orion 方法获取这些属性?
详情请见下方:
一行 mongodb:
{
"_id" : {
"id" : "sb1_dv1_5",
"type" : "Call",
"servicePath" : "/"
},
"attrNames" : [
"status",
"type",
"to"
],
"attrs" : {
"status" : {
"type" : "string",
"creDate" : 1488876118,
"modDate" : 1488876118,
"value" : "open",
"mdNames" : []
},
"type" : {
"type" : "string",
"creDate" : 1488876118,
"modDate" : 1488876118,
"value" : "video",
"mdNames" : []
},
"to" : {
"type" : "string",
"creDate" : 1488876118,
"modDate" : 1488876118,
"value" : "police",
"mdNames" : []
}
},
"creDate" : 1488876118,
"modDate" : 1488876118
}
非常感谢。
如果您使用的是最新的 Orion 版本之一(我认为它是在 1.5.0 中引入的),您可以在 metadata
字段中使用 dateCreated
和 dateModified
在 notification
内创建订阅,例如:
POST /v2/subscriptions
{
...
"notification": {
...
"metadata": [ "dateCreated", "dateModified", "*" ]
...
}
...
}
查看 NGSIv2 latest specification 的 "Filtering out attributes and metadata" abd "System/builtin Metadata" 部分了解更多详情。
UPDATE: 以上是指 dateCreated 和 dateModified metadata(具有属性的创建和修改日期)。如果您想要 dateCreated 和 dateModified attributes(将整个实体的创建和修改日期)以类似的方式添加,但使用 attrs
字段,例如:
POST /v2/subscriptions
{
...
"notification": {
...
"attrs": [ "dateCreated", "dateModified", "*" ]
...
}
...
}
查看 NGSIv2 latest specification 的 "Filtering out attributes and metadata" abd "System/builtin Attributes" 部分了解更多详情。
我正在尝试使用 subscribeContext 和通知(参见 link https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv1/index.html#ngsi10-standard-operations)
与mongodb一样,有creDate和modDate属性,但在notifyContextRequest payload中没有这两个属性。
是否可以将 creDate 和 modDate 属性包含到 notifyContextRequest 负载中?
有没有办法使用 Orion 方法获取这些属性?
详情请见下方: 一行 mongodb:
{
"_id" : {
"id" : "sb1_dv1_5",
"type" : "Call",
"servicePath" : "/"
},
"attrNames" : [
"status",
"type",
"to"
],
"attrs" : {
"status" : {
"type" : "string",
"creDate" : 1488876118,
"modDate" : 1488876118,
"value" : "open",
"mdNames" : []
},
"type" : {
"type" : "string",
"creDate" : 1488876118,
"modDate" : 1488876118,
"value" : "video",
"mdNames" : []
},
"to" : {
"type" : "string",
"creDate" : 1488876118,
"modDate" : 1488876118,
"value" : "police",
"mdNames" : []
}
},
"creDate" : 1488876118,
"modDate" : 1488876118
}
非常感谢。
如果您使用的是最新的 Orion 版本之一(我认为它是在 1.5.0 中引入的),您可以在 metadata
字段中使用 dateCreated
和 dateModified
在 notification
内创建订阅,例如:
POST /v2/subscriptions
{
...
"notification": {
...
"metadata": [ "dateCreated", "dateModified", "*" ]
...
}
...
}
查看 NGSIv2 latest specification 的 "Filtering out attributes and metadata" abd "System/builtin Metadata" 部分了解更多详情。
UPDATE: 以上是指 dateCreated 和 dateModified metadata(具有属性的创建和修改日期)。如果您想要 dateCreated 和 dateModified attributes(将整个实体的创建和修改日期)以类似的方式添加,但使用 attrs
字段,例如:
POST /v2/subscriptions
{
...
"notification": {
...
"attrs": [ "dateCreated", "dateModified", "*" ]
...
}
...
}
查看 NGSIv2 latest specification 的 "Filtering out attributes and metadata" abd "System/builtin Attributes" 部分了解更多详情。