opensensorhub / osh-core

OpenSensorHub Core Modules
http://docs.opensensorhub.org
Mozilla Public License 2.0
32 stars 16 forks source link

[CSAPI] Accessing System added through HTTP POST w/ GeoJSON may not be navigable in browser #248

Open ChainReaction31 opened 8 months ago

ChainReaction31 commented 8 months ago

I noticed that when navigating the API in a browser that a system I inserted with GeoJSON gives an error when I try to navigate to it using its canonical url.

If I add a query parameter f=application/json it is then available.

ChainReaction31 commented 8 months ago

I very briefly looked around at this. I attempted a very similar operation from Postman with the body being this:

{
    "type": "Feature",
    "properties": {
        "name": "Test System From Postman",
        "uid": "urn:test:frompostman1",
        "description": "A Test System",
        "featureType": "http://www.w3.org/ns/ssn/System"
    }
}

Notably, the response I get form the server does not contain featureType

{
  "type": "Feature",
  "id": "9koctd6kei2be",
  "geometry": null,
  "properties": {
    "uid": "urn:test:frompostman1",
    "name": "Test System From Postman",
    "description": "A Test System"
  },
  "links": [
    {
      "rel": "canonical",
      "href": "http://localhost:8181/sensorhub/api/systems/9koctd6kei2be",
      "type": "application/json"
    },
    {
      "rel": "alternate",
      "title": "Detailed description of system in SensorML format",
      "href": "http://localhost:8181/sensorhub/api/systems/9koctd6kei2be",
      "type": "application/sml+json"
    },
    {
      "rel": "members",
      "title": "List of subsystems",
      "href": "http://localhost:8181/sensorhub/api/systems/9koctd6kei2be/members",
      "type": "application/json"
    },
    {
      "rel": "datastreams",
      "title": "List of system datastreams",
      "href": "http://localhost:8181/sensorhub/api/systems/9koctd6kei2be/datastreams",
      "type": "application/json"
    },
    {
      "rel": "controls",
      "title": "List of system control channels",
      "href": "http://localhost:8181/sensorhub/api/systems/9koctd6kei2be/controls",
      "type": "application/json"
    },
    {
      "rel": "samplingFeatures",
      "title": "List of system features of interest",
      "href": "http://localhost:8181/sensorhub/api/systems/9koctd6kei2be/featuresOfInterest",
      "type": "application/json"
    }
  ]
}