Creating a Rockseven HTTP POST endpoint to receive Rockblock modem data

Rockseven has a nifty feature where data sent via the Rockblock modem can be sent to various endpoints. Besides having the data emailed, it is useful to have that data parsed by a website to display the data in a user friendly way (like on a tracking map!). Below is my implementation for LoCARB. Its pretty self explanatory and I’ve left the debugging portions of it for anyone to use. Just be sure to change the domain name to where your MySQL database resides and enter in your own username and password.

I also used this php endpoint to format any incoming data that needed it. In the previous post about packing a message to be sent via the satellite modem, I initially formatted the GPS coordinates to be sent with a decimal. In the end I decided to just leave all formatting functions to the endpoint so as to simplify the Arduino or Javascript code (for maps). In the code below, you’ll see expressions for adding decimal places, converting m/s to knots, km to miles, and miles to nautical miles.

The output result looks like so:

An important lesson learned…

For directions on how to add an HTTP POST endpoint in your dashboard, download the RockSeven user guide and go to the very last page. After adding your endpoint, you’ll be able to test the endpoint by navigating to the ‘Test Delivery Groups’ selection on the bottom left menu (image below). Select your device group and click the ‘Send Test’ button to check and see if your endpoint is working as it should. If it is, there should be data in your database. Be aware that my code does not directly populate every field that is sent by the Rockseven POST submission and as such, you will just see your IMEI populate in the database.

One important thing to note is when testing your endpoint, do not repeatedly click the Send Test button as it will disable it after a few clicks. It did to me and I wasn’t able to add any URLs for a while.