venge
venge

Reputation: 187

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

Question title pretty much self explanatory. It is possible to create an id-less entity in Orion. An id = .* query returns normally as an id-less, although existing entity. But how can someone delete that entity? This request didn't work obviously:

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

This is the returned query:

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

Upvotes: 1

Views: 156

Answers (1)

LeandroGuillen
LeandroGuillen

Reputation: 518

There is a known bug (now fixed) in Orion that seems to be causing your issue. Basically Orion interprets the final "/" at the end of an URL as an empty element.

For example (as documented in the issue):

  • v1/contextEntityTypes queries for all types, while
  • v1/contextEntityTypes/ queries only for the empty type

In your particular case, something similar happens with some REST operations. If you do a GET /v1/contextEntities you will see all entities, including the empty-id one. You can query that particular entity with GET /v1/contextEntity/ (note the final "/").

And then, the DELETE method doesn't seem to use the same pattern. So if you do DELETE /v1/contextEntity/ You get a No context element found.

So, basically, this is another manifestation of a known bug.

Upvotes: 1

Related Questions