Hi all, I'm working on an app that will log things in Google Sheets. I figured it was wise to use asynchttpPost. The post is working fine but I can't seem to figure out the error handling.
I've tried many of the methods documented here but everything but getStatus() and getHeaders() throws java.lang.Exception
you can get a full list of the return post using "response.properties" . This will identify the available data fields (i.e., data, json, etc) in the response as well as data that may point you to an error in the original message. That will help to guide what is in the response.
below is some working code using httpPost and (if an error) resp.properties. note that my url is an https://..... If yours url is an https, you will need the "ignoreSSLIssues: true" in the parameters.
I use the same method to send the HTTP Sync method from all commands (on, off, set color, turn start vacuuming, etc) with different parse methods (action) depending on the expected return data. Then the "action" method call the parse method (all responses from these devices require the same decoding/formatting prior to actually extracting the response data).
Reduces code to develop and validate as well as troubleshoot. If there is an error raised from parseData method, I only have to fix it once. May not be necessary in your implementation!