I have a sim7600A-H and I'm trying to use the Firebase realtime database REST api to send the device's coordinates
The api requires https, so I originally used the AT+HTTP commands to send data. But that only allows GET/POST/HEAD, I need to send a PUT or PATCH to prevent duplicate data with every request in the database
I created a PUT request using the TCP/IP AT commands and X-HTTP-Method-Override: PUT
However, now I get a 400 Bad Request code and "The plain HTTP request was sent to HTTPS port"
Here's the .ino code I'm using to send the PUT request:
String tcp_data = "POST /path/to/users/simcom.json? HTTP/1.1\n";
tcp_data = tcp_data + "Host:project-default-rtdb.firebaseio.com\n";
tcp_data = tcp_data + "X-HTTP-Method-Override: PUT\n";
tcp_data = tcp_data + "..."; // Json data here
sendData("AT+NETCLOSE", 2000, DEBUG);
sendData("AT+CSOCKSETPN=1", 2000, DEBUG);
sendData("AT+CIPMODE=0", 2000, DEBUG);
sendData("AT+NETOPEN", 2000, DEBUG);
sendData("AT+CIPOPEN=0,\"TCP\",\"project-default-rtdb.firebaseio.com\",443", 2000, DEBUG);
sendData("AT+CIPSEND=0," + String(tcp_data.length()), 2000, DEBUG);
sendData(tcp_data, 2000, DEBUG);
Couple of side notes if they are of any use:
I strictly followed this tutorial for AT commands: TCP/IP testing with Simcom SIM7500 and SIM7600 Modules | M2MSupport.net
And followed the documentation for the rest api:
https://firebase.google.com/docs/database/rest/save-data