Info about send to own api

Hello everyone,
i am looking for get data by “send to own api”.
if i put the url and path of my php, i can’t reach my file. any idea? if call directy by url i reach him without problems. You can help me?
Very thanks.
Al.

Is it the original master firmware ? I do not recognize the layout.
The port and the rest a good ?

It looks like this in a config that works:

// define own API
static const char HOST_CUSTOM[] PROGMEM = "xxxxxxx.fr";
static const char URL_CUSTOM[] PROGMEM = "/influx/dataModuleAir_v2_wifi.php";

Are you sure you have no typos in URL or so?

Hello pjt and Ben21 , thank you for your reply,
if called by browser, i reach the php script without problems.
now for testing, if call my url i create a blank json file in host folder.
what do you thnik?

Can you read the serial logs in USB? It should point the issue out.

Hello, this is my log:

2022-11-26 09:26:17: a2022-11-26 09:26:20: ## Sending to custom api: 
2022-11-26 09:26:20: Start connecting to https://www.xyxyxyxyxy.com
2022-11-26 09:26:20: https://www.xyxyxyxyxy.com
2022-11-26 09:26:20: 80
2022-11-26 09:26:20: /davis/airquality/lora.php
2022-11-26 09:26:20: {"esp8266id": "6503506", "software_version": "NAMF-2020-44", "sensordatavalues":[{"value_type":"SDS_P1","value":"2.20"},{"value_type":"SDS_P2","value":"1.00"},{"value_type":"HECA_temperature","value":"20.95"},{"value_type":"HECA_humidity","value":"50.15"},{"value_type":"HECA_Tdc","value":"0.00"},{"value_type":"HECA_RHdc","value":"0.00"},{"value_type":"HECA_dc","value":"0.00"},{"value_type":"BME280_temperature","value":"20.60"},{"value_type":"BME280_pressure","value":"102652.48"},{"value_type":"BME280_humidity","value":"49.02"},{"value_type":"samples","value":"100166"},{"value_type":"min_micro","value":"1326"},{"value_type":"max_micro","value":"214147"},{"value_type":"signal","value":"-43"}]}
2022-11-26 09:26:39: Not succeeded 
2022-11-22022-11-26 09:26:39: validate request auth...
2022-11-26 09:26:39: validate request auth...
2022-11-26 09:26:40: validate request auth...

about servers I don’t know too much, but if i paste my url by browser, create file locally.
seems that system not call my page

2022-11-26 09:26:20: https://www.xyxyxyxyxy.com
2022-11-26 09:26:20: 80

HTTP and port 80 or HTTPS and port 433 maybe?

Hello is there any update. I try to get the values into a simple node red.
When I call
http://192.168.2.147:1880/sensor?test=2 directly from a browser. Node red will receive the call und response just the same values.
My configuration:

Any suggestions?

I was told, you should not write http://, only the adress.

unfortunately not
i try a lot of posible configurations.

following the code it should be easy. I don’t understand why.
Server “192.168.2.147”
URL “/sensor”
Port 1880

#define HOST_MADAVI “api-rrd.madavi.de
#define URL_MADAVI “/data.php”
#define PORT_MADAVI 80

#define HOST_DUSTI “api.sensor.community”
#define URL_DUSTI “/v1/push-sensor-data/”
#define PORT_DUSTI 80

I also changed it to:
http://192.168.2.147:1880/sensor.php?test=2


nothing

Hello, I’ve been using my own api for a while now and everything works fine.

My setup:

A server running on Apache with php installed.
A file with
image
then send to your database the json.

My config for the sensor:
static const char HOST_CUSTOM2[] PROGMEM = “192.168.*.”;

static const char URL_CUSTOM2[] PROGMEM = “/myFile.php”;

#define PORT_CUSTOM2 80

Debug:
Try port 80 and not 1880 (port maybe close by your server)
Check server logs for communication and php logs for errors in the json parsing.
Use postman to “simulate” the POST request on you server.

Hope this hepl

1 Like