Torbjorn in Discussions
上次活动时间: 2024-11-18

Hello I have 3 devices (IOT board using SIM7600 module) sending one value to Thingsspeak. Have been working just fine a couple of years. However 14/11-24 I receive http error code 406 for all 3 devices. The http get is working just fine when testing directly in the browser (https://api.thingspeak.com/update?api_key=xxxxx&field1=33), the server return the entrie number. However, when running the same address via SIM7600 I receive - +HTTPACTION: 0,406,0 Any tips for the 406 error code? Http response error 406 internet says 406 is unaceptable. Perhaps you are making a header request that we dont do. Can you share anything more about the request format? Perhaps there was a security upgrade at our end that your request is not addressing? I believe this is most likely this is because invalid content-type header is being set. The browser automatically sets the header, but, your embedded firmware is setting the header manually and likely using an invalid header. The valid content-type headers are described here: https://www.mathworks.com/help/thingspeak/writedata.html First, I’d like to thank everyone who contributed their suggestions and insights—it’s much appreciated! Since last Thursday, HTTP GET requests from the SIM7600 module to ThingSpeak were returning a 406 error (+HTTPACTION: 0,406,0), indicating that the server found the request unacceptable. However, the same request worked fine in a browser. As suggested that the issue was related to the headers or format of the request being sent by the SIM7600. Actions Taken Debugging the SIM7600 HTTP Request: We used httpbin.org to analyze the actual HTTP headers and payload being sent by the SIM7600 module. It was observed that the User-Agent header was either missing or empty, and no Content-Type header was included. Modifying the HTTP Headers: We added a User-Agent header explicitly using: AT+HTTPPARA="UA","SIM7600_MODULE" This ensures the server recognizes the request as coming from a legitimate source. We added a Content-Type header (though typically required for POST requests, ThingSpeak now seems to enforce it for GET as well): AT+HTTPPARA="CONTENT","application/x-www-form-urlencoded" Validating the Solution: After adding the headers, the HTTP GET request to ThingSpeak worked as expected, and data updates were successful. Testing Workflow: The final working sequence for a GET request to ThingSpeak is as follows: AT+HTTPINIT AT+HTTPPARA="CID",1 AT+HTTPPARA="URL","http://api.thingspeak.com/update?api_key=YOUR_API_KEY&field1=10" AT+HTTPPARA="UA","SIM7600_MODULE" AT+HTTPPARA="CONTENT","application/x-www-form-urlencoded" AT+HTTPACTION=0 The response from AT+HTTPACTION now includes 200 (success), and the channel updates correctly. The issue was resolved by explicitly setting the User-Agent and Content-Type headers in the HTTP request. It seems ThingSpeak has recently implemented stricter validation of HTTP requests, requiring these headers to be present. Thaks so much for the explanation of your journey! Im happy to hear you were able to resolve the problem. Thank you for sharing the steps on your end. Indeed, a recent upgrade of the underlying framework did make the application more strict with respect to certain required headers. sim7600 error 406

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.