Skip to content

Multiple bugs in Create Observation entities with dataArray #458

Description

@S-Panta

Post request to /sensorthings/v1.1/CreateObservations have multiple bugs. I have manually tested few scenerios and noticed few bugs.

This has been tested with the local build of hydroserver with django-ogc-sensorthings-1.2

curl --location 'http://127.0.0.1:8000/api/sensorthings/v1.1/CreateObservations' \
--header 'accept: */*' \
--header 'X-Api-Key: T8QqUHDAuWLWrW6rutXUBwQmKyAWgFbZ4ItG3XIuO1vGD-c3VPSJgIo' \
--header 'Content-Type: application/json' \
--data-raw '[
    {
        "Datastream": {
            "@iot.id": "019eae3f-3450-70db-b5d2-a55879b4d681"
        },
        "components": [
            "phenomenonTime",
            "result"
        ],
        "dataArray": [
            [
                "2026-06-30T23:33:00+00:00",
                1000
            ]
        ]
    }
]'
  • Creating same observation multiple time returns status code of 201 (created) with [error] body. The status code mustn't be 201.
  • Suppose I created list of observation with data as follows:
[
    {
        "Datastream": {
            "@iot.id": "019eae3f-3450-70db-b5d2-a55879b4d681"
        },
        "components": [
            "phenomenonTime",
            "result"
        ],
        "dataArray": [
            [
                "2026-06-30T23:39:00+00:00",
                1500
            ],
            [
                "2026-06-30T23:40:02+00:00",
                4500
            ]
        ]
    }
]

Then if I try to create an observation with dataarray by keeping first data as same and updating second array, the specification says the response should be

[
  "http://examples.org/v1.1/Observations(1)",
  "error",
  "http://examples.org/v1.1/Observations(2)"
]

But this is not the case with the api. Any new data therefore send with existing data, the service will return with [error] body and doesn't update new data - which is opposite of what ogc specify.

  • posting with data array as empty list result in 201 status code.

  • posting with components with empty array and data array as empty list result in 201 status code. However, if there are values in dataarray, posting with empty component gives 422 status code which is okay.

  • post with wrong datastream id also give 201 but error as body (which is I guess what ogc specifies which feels very werid) and no observation data is updated in the server.

There could be more multiple cases here that might give more error.
I may either have misunderstood the specification regarding it's proposal of using 201 status code but it seems like every unfriendly reuqest gives 201 status code which isn't the correct HTTP status code response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions