Search code examples
fiwarefiware-orion

Method Not Allowed when patching registration


Recently some registrations of commands expired so I am trying to patch their "expires" attribute. However, I receive a 405 method not allowed message error.

Retrieving info about the registration:

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"
}

I attempted following the example from 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"
}'

But as I said I got the error message: 405 Method Not Allowed

Feel free to ask for more info.


Solution

  • The operation to modify registrations has not been yet implemented in Orion 2.2.0 (last version in the moment of writing this). As mentioned in 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.

    However, the workaround is pretty simple: delete the old registration and create a new one with the modified parameters.