如何删除 Orion 中的 id-less 个实体?

How can I delete an id-less entity in Orion?

问题标题几乎不言自明。 可以在 Orion 中创建一个 id-less 实体。 id = .* 查询 returns 通常作为 id-less,尽管存在实体。但是有人怎么能删除那个实体呢?此请求显然无效:

{
  "contextElements": [
   {
      "type": "",
      "isPattern": "false",
      "id": ""
    }
  ],
  "updateAction": "DELETE"
}

这是返回的查询:

{
            "contextElement": {
                "type": "",
                "isPattern": "false",
                "id": "",
                "attributes": [
                    {
                        "name": "temp",
                        "type": "integer",
                        "value": "15"
                    },
                    {
                        "name": "pressure",
                        "type": "integer",
                        "value": "720"
                    }
                ]
            },
            "statusCode": {
                "code": "200",
                "reasonPhrase": "OK"
            }
        }

Orion 中有一个 known bug(现已修复)似乎导致了您的问题。 Orion 基本上将 URL 末尾的最后一个“/”解释为空元素。

例如(如问题中所述):

  • v1/contextEntityTypes 查询所有类型,而
  • v1/contextEntityTypes/ 只查询空类型

在您的特定情况下,某些 REST 操作会发生类似的情况。如果您执行 GET /v1/contextEntities 您将看到所有实体,包括空 ID 实体。您可以使用 GET /v1/contextEntity/ 查询该特定实体(注意最后的“/”)。

然后,DELETE 方法似乎没有使用相同的模式。因此,如果你执行 DELETE /v1/contextEntity/ 你会得到一个 No context element found.

所以,基本上,这是已知错误的另一种表现形式。