HTTP Communication

Communicating with the TrackMyRide servers via HTTP is one of the easiest ways to report position data. There is more overhead involved when using HTTP than either UDP or MQTT. However, the ease of using HTTP may make it the choice for low volume devices.

The idea is simple; Any device that can establish a connection with a web server via HTTP can report data to the server. You can even use a web browser to communicate and test your connection.

To test HTTP follow the steps below.

  • Log in to your account
  • Locate your device's API key (see below)
  • Create the data portion of the URL
  • Send the URL to the address http://www.trackmyride.us/iot/web-report.aspx with the appropriate id and data parameters (see below)

Locate your device API key

To locate your device's API key login to your account, find the device, click the caret next to the device to expand the details. Locate the API key and copy it.

Locating your device's API key

Formatting the URL

The first part of the URL will always be the same.

URL format

The next part of the URL identifies the device for which the report is being generated. Use your device's API key to format this part of the URL.

URL parameters

Be sure to put the ?id= in the line. The ? tells the server that this is the first URL parameter. The id is the variable name the server uses to identify the property (in this case the API key of the device.

Data parameter

This part of the URL contains the location parameters for the device. It consists of the NMEA location data that is generated by most GPS devices. Each parameter contained in the data string represents a key value from the GPS. Below is a breakdown of the string.

Parameter Description
&data= This is the variable the server uses to identify the parameter string. This is required. Be sure it is formatted exactly as shown
1 GPS Sentance type. This tells the page the format of the data that follows. Currently, only the $GPRMC string is support
2 Time from the GPS (Expressed in UTC format). HHMMSS
3 GPS receiver warning A = OK, V = Warning
4 Latitude in NMEA format. Format is DDMM.MMMMM (Decimal places are variable). It is important that the latitude (and longitude) remain in this format. The page expects this format and converts it to Decimal Degree format for internal use.
5 Designates the latitude direction. This is always a single character (N or S depending on the hemisphere)
6 Longitude in NMEA format. Format is DDMM.MMMMM (Decimal places are variable). It is important that the longitude (and latitude) remain in this format. The page expects this format and converts it to Decimal Degree format for internal use.
7 Designates the longitude direction. This is always a single characters (E or W) depening on your position
8 Denotes ground speed in knots
9 Represents the true course
10 The date of the fix (DDMMYY)
11 Magnetic variation (not used. Generally left blank)
12 Checksum. Automatically generated by the receiver. Not used by the TrackMyRide system.

To communicate with the TrackMyRide system your device only has to read the GPS data, create a string and send it to the server using the address shown above.

Some other things to note are:

  • You must use the web address listed above
  • You must send data on TCP port 80 (the well-known port for HTTP)
  • Your device API key must follow the id parameter
  • You must use the data parameter for your GPS data
  • Your longitude and latitude must be in the NMEA format (not decimal degrees)
  • Even though the system does not use the magnetic variation you must still account for the parameter
  • Make sure you use all 12 parameters

Sample Windows Program

The developers at TrackMyRide created a sample C# console program that read a USB GPS, connects to a Wi-Fi network and uses HTTP to communicate with the TrackMyRide server in the same manner as described above. You may use all or part of the code in any project for personal or commercial use.

View and download the code from here.

TRACKMYRIDE

We are an open source, free device tracking website. Track anything, anytime, anywhere. If you have an application that is connected to the Internet you can track it with our software.

Lastest Updates