I’m wondering if it would be possible to push the data from my luftdaten.info server directly to the oh2 restAPI. In the configuration of the luftdaten server I can enter
The server will send a similar json formatted datatype of this format
{
"esp8266id": "534958",
"software_version": "NRZ-2017-099",
"sensordatavalues":[
{"value_type":"SDS_P1","value":"4.47"},
{"value_type":"SDS_P2","value":"4.03"},
{"value_type":"temperature","value":"15.60"},
{"value_type":"humidity","value":"75.20"},
{"value_type":"samples","value":"635908"},
{"value_type":"min_micro","value":"226"},
{"value_type":"max_micro","value":"27791"},
{"value_type":"signal","value":"-90"}
]
}
I get the following error mesage on my luftdaten server
## Sending to custom api:
Start connecting to hab
Requesting URL: /rest/items/luftdaten
659987
{"esp8266id": "659987", "software_version": "NRZ-2018-123B", "sensordatavalues":[{"value_type":"SDS_P1","value":"4.00"},{"value_type":"SDS_P2","value":"0.50"},{"value_type":"BME280_temperature","value":"28.72"},{"value_type":"BME280_humidity","value":"27.08"},{"value_type":"BME280_pressure","value":"100411.41"},{"value_type":"samples","value":"1823813"},{"value_type":"min_micro","value":"78"},{"value_type":"max_micro","value":"21029"},{"value_type":"signal","value":"-61"}]}
HTTP/1.1 415 Unsupported Media Type
Content-Type: application/json
Content-Length: 227
Connection: close
Server: Jetty(9.3.21.v20170918)
{"error":{"message":"HTTP 415 Unsupported Media Type","http-code":415,"exception":{"class":"javax.ws.rs.NotSupportedException","message":"HTTP 415 Unsupported Media Type","localized-message":"HTTP 415 Unsupported Media Type"}}}
closing connection
----
The error is correct, because only plain text is allowed.
How can I post json formated data into the rest api?