Can't push data

I’m trying to push data from a PMS-5003 with my own code. When I try to POST the data, the server responds with code 301. Here is a sample data payload:
“software_version”: “myfirmware”,
“sensordatavalues”: [
“value_type”: “P2”,
“value”: “15.0”

and here is sample output when I test with curl:

$ curl -v -H “Content-Type: application/json” -H “X-Sensor: esp32-xxxxxxxx” -H “X-PIN: 1” --data-binary “@test.json

  • Trying…
  • Connected to ( port 80 (#0)

POST /v1/push-sensor-data HTTP/1.1
User-Agent: curl/7.74.0
Accept: /
Content-Type: application/json
X-Sensor: esp32-xxxxxxx
X-PIN: 1
Content-Length: 130

  • upload completely sent off: 130 out of 130 bytes
  • Mark bundle as not supporting multiuse
    < HTTP/1.1 301 Moved Permanently
    < Date: Thu, 06 Jul 2023 22:41:35 GMT
    < Server: Apache/2
    < Location: /v1/push-sensor-data/
    < Access-Control-Allow-Origin: *
    < X-Content-Type-Options: nosniff
    < Transfer-Encoding: chunked
    < Content-Type: text/html; charset=utf-8
  • Connection #0 to host left intact

When I send the data to
instead, it replies with

Sensor: esp32-xxxxxxxx

but the data never show up in grafana.

What am I doing wrong?

Welcome on board!

SC API endpoint:

Headers should be for SDS011:

Content-Type: application/json  
X-Pin: 1  
X-Sensor: esp32-xxxxxxxxxx 

The data should look like this:

  "software_version": "something", 

Madavi API endpoint:

Headers should be for SDS011:

Content-Type: application/json  
X-Pin: 1  
X-Sensor: esp32-xxxxxxxxx

The data should look like this:

  "software_version": "something", 

The data is slightly different between the 2 APIs.

Check if the

Thank you so much for the help! I spent most of yesterday trying to figure out what I was doing wrong, with no luck.

My mistake with the SC API was that I was using

instead of

For madavi, there were 2 problems:

  1. I used P2 instead of SDS_P2 for value_type
  2. Even after I changed it to SDS_P2, my data didn’t show up until I sent all 3 values, SDS_P0, SDS_P1 and SDS_P2. If you leave any of them out, it ignores the sample!

Do we need to upload to both servers, or is it enough to just upload to SC? I am not sure what the madavi API is used for besides grafana.

Also, what update interval is preferred for SC API?

Madavi is used for debugging. @ricki-z Do he really have to send to Madavi as well ?
Please use 5 minutes interval. And if some holes appear in the curves reduce a bit.

I was only exporting PM2.5 to the SC API, and was able to see the data through the SC API with

But my sensor was not showing up on the map. Also, I couldn’t see any data via grafana.

Single Sensor view (for map) - Dashboards - Grafana (

After I added PM1 and PM10, it shows on the map and grafana. So the map needs more than just PM2.5 in order to for a sensor to show up. This is a peculiar requirement. I don’t usually bother with anything besides PM2.5, because the PM1 & PM10 estimates tend to be inaccurate.

I am not sending data to the Madavi API, so I guess it isn’t required.

Hello @lincomatic
you need to use your chipID at Madavi (grafana) , not the ID generated by our main database.
And you should change your user agent in the POST request to something unique. Generic requests might be blocked as those are normally made by crawlers which won’t post any data.
Please also change the request URL to /v1/push-sensor-data/ (with the slash at the end). This will generate only one instead of two requests.

Yes, I’ve been doing exactly what you asked. The strange thing is just that I had to add PM10, or my sensor wouldn’t show up on the map. Thanks for the reply.