修补注册时不允许使用方法

Method Not Allowed when patching registration

最近一些命令注册已过期,因此我正在尝试修补它们的 "expires" 属性。但是,我收到 405 method not allowed 消息错误。

正在检索有关注册的信息:

curl -X GET \
http://localhost:1026/v2/registrations/5d3ff3e2ab1e270d7775a7bf \
-H 'Accept: application/json'
{
    "id": "5d3ff3e2ab1e270d7775a7bf",
    "expires": "2019-08-29T07:38:10.00Z",
    "dataProvided": {
        "entities": [
            {
                "id": "urn:ngsi-ld:ActuatorScreenshot:001",
                "type": "Actuator"
            }
        ],
        "attrs": [
            "Screen"
        ]
    },
    "provider": {
        "http": {
            "url": "http://localhost:4041"
        },
        "supportedForwardingMode": "all",
        "legacyForwarding": true
    },
    "status": "active"
}

我尝试按照 http://telefonicaid.github.io/fiware-orion/api/v2/stable/ 中的示例进行操作:

curl -X PATCH \
  http://localhost:1026/v2/registrations/5d3ff3e2ab1e270d7775a7bf \
  -d '{
    "expires":"2040-10-04T00:00:00"
}'

但正如我所说,我收到了错误消息: 405 Method Not Allowed

欢迎随时询问更多信息。

Orion 2.2.0(撰写本文时的最新版本)尚未实现修改注册的操作。如Orion documentation所述:

Orion implements registration management as described in the NGSIv2 specification, except for the following aspects:

  • List item PATCH /v2/registration/<id> is not implemented. Thus, registrations cannot be updated directly. I.e., updates must be done deleting and re-creating the registration. Please see this issue about this.

但是,解决方法非常简单:删除旧注册并使用修改后的参数创建一个新注册。