Skip to content

Location Data Schema

Chris Scott edited this page Aug 11, 2023 · 2 revisions

Javascript Callback Schema

{
    "timestamp":     [Date],     // <-- Javascript Date instance
    "age":           [Integer],  // <-- Age of the location in milliseconds
    "event":         [String],   // <-- motionchange|geofence|heartbeat
    "is_moving":     [Boolean],  // <-- The motion-state when location was recorded.
    "is_heartbeat"   [Boolean],  // <-- If this location was recorded during heartbeat-mode
    "uuid":          [String],   // <-- Universally unique identifier
    "coords": {
        "latitude":  [Float],
        "longitude": [Float],
        "accuracy":  [Float],
        "speed":     [Float],
        "heading":   [Float],
        "altitude":  [Float]
    },
    "activity": {               
        "type": [still|on_foot|walking|running|in_vehicle|on_bicycle],
        "confidence": [0-100%]
    },
    "battery": {
        "level": [Float],
        "is_charging": [Boolean]
    },
    "odometer": [Float/meters]
}

HTTP POST Schema

The location-data schema POSTed to your server takes the following form:

{
    "location": {
        "coords": {
            "latitude":   [Float],
            "longitude":  [Float],
            "accuracy":   [Float],
            "speed":      [Float],
            "heading":    [Float],
            "altitude":   [Float]
        },
        "extras": {   // <-- optional extras.  @see #getCurrentPosition for details
            "foo": "bar"
        },
        "activity": {
            "type": [still|on_foot|walking|running|in_vehicle|on_bicycle|unknown],
            "confidence": [0-100%]
        },
        "geofence": {  // <-- Present only if a geofence was triggered at this location
            "identifier": [String],
            "action": [String ENTER|EXIT]            
        },
        "battery": {
            "level": [Float],
            "is_charging": [Boolean]
        },
        "timestamp": [ISO-8601 UTC], // eg:  "2015-05-05T04:31:54.123Z"
        "age":       [Integer],      // <-- Age of the location in milliseconds
        "uuid":      [String],       // <-- Universally unique identifier
        "event"      [String],       // <-- motionchange|geofence|heartbeat
        "is_moving": [Boolean],      // <-- The motion-state when location was recorded (@deprecated; use #event)
        "is_heartbeat: [Boolean],    // <-- If this location was recorded during heartbeat mode.
        "odometer": [Float/meters]
    }
}

Note: location is an array for batched requests

Clone this wiki locally