TripQube HTTP REST API Documentation

← Back to Home

Integrate GPS tracking and location services using our HTTP REST API. Perfect for web applications, server-side integrations, and general-purpose development.

💡 Looking for MQTT/IoT Integration?

For hardware GPS devices and IoT applications, check out our MQTT Integration Guide →

🔧 Device Registration

Register and authenticate devices via HTTP endpoints.

  • RESTful API design
  • 5-digit PIN authentication
  • No user auth required

📍 Location Tracking

Push real-time location data via HTTP POST requests.

  • Single or batch updates
  • Offline buffering support
  • Real-time trip tracking

💻 Simple Integration

Easy integration for web and server applications.

  • JSON request/response
  • Python examples
  • JavaScript/Node.js examples

📝 Register Approved Device

Register a new hardware device to the TripQube system. This is a public endpoint that does not require user authentication.

Endpoint: https://registerapproveddevice-3y3utatgia-uc.a.run.app
Method: POST
Authentication: None (Public)
Content-Type: application/json

Request Body

{
  "device_id": "TRK-ABC-12345",
  "pin": "98765",
  "firmware_version": "2.1.0",
  "manufacturer": "TripQube Hardware"
}

Request Parameters

Field Type Required Description
device_id string ✅ Yes Unique device identifier (max 100 chars)
pin string ✅ Yes 5-digit authentication PIN
firmware_version string ✅ Yes Device firmware version (max 50 chars)
manufacturer string ✅ Yes Device manufacturer name (max 100 chars)

Success Response (200 OK)

{
  "success": true,
  "message": "Approved device registered successfully.",
  "device_id": "TRK-ABC-12345"
}

📍 Push Tracker Location

Push location data from your hardware device to update tracker position. Supports both single location updates and buffered batch updates for offline scenarios.

Endpoint: https://pushtrackerlocation-3y3utatgia-uc.a.run.app
Method: POST
Authentication: Device credentials (device_id + pin)
Rate Limiting: None

Single Location Update

{
  "device_id": "TRK-ABC-12345",
  "pin": "98765",
  "latitude": 37.7749,
  "longitude": -122.4194,
  "battery_level": 85,
  "timestamp": 1705012345000
}

Buffered Locations (Batch Update)

{
  "device_id": "TRK-ABC-12345",
  "pin": "98765",
  "location_buffer": [
    {
      "latitude": 37.7749,
      "longitude": -122.4194,
      "timestamp": 1705012345000,
      "speed": 15.5,
      "altitude": 50
    },
    {
      "latitude": 37.7750,
      "longitude": -122.4195,
      "timestamp": 1705012375000,
      "speed": 20.2,
      "altitude": 55
    }
  ],
  "battery_level": 84
}

Request Parameters

Field Type Required Description
device_id string ✅ Yes Hardware device identifier
pin string ✅ Yes 5-digit authentication PIN
latitude number ⚠️ Conditional* Latitude (-90 to 90) for single update
longitude number ⚠️ Conditional* Longitude (-180 to 180) for single update
battery_level number ❌ Optional Battery percentage (0-100)
timestamp number ❌ Optional Unix timestamp (ms or seconds)
location_buffer array ⚠️ Conditional* Array of location objects for batch update

* Either (latitude AND longitude) OR location_buffer must be provided.

💻 Integration Examples

Python

Simple Python implementation for pushing location data via HTTP.

import requests
import time

DEVICE_ID = "TRK-ABC-12345"
PIN = "98765"
PUSH_URL = "https://pushtrackerlocation-3y3utatgia-uc.a.run.app"

def push_location(lat, lon, battery=None):
    payload = {
        "device_id": DEVICE_ID,
        "pin": PIN,
        "latitude": lat,
        "longitude": lon,
        "timestamp": int(time.time() * 1000)
    }
    
    if battery is not None:
        payload["battery_level"] = battery
    
    response = requests.post(PUSH_URL, json=payload)
    return response.json()

# Usage
result = push_location(37.7749, -122.4194, battery=85)
print(result)

JavaScript/Node.js

Example implementation for Node.js server applications.

const axios = require('axios');

const DEVICE_ID = 'TRK-ABC-12345';
const PIN = '98765';
const PUSH_URL = 'https://pushtrackerlocation-3y3utatgia-uc.a.run.app';

async function pushLocation(lat, lon, battery = null) {
  const payload = {
    device_id: DEVICE_ID,
    pin: PIN,
    latitude: lat,
    longitude: lon,
    timestamp: Date.now()
  };

  if (battery !== null) {
    payload.battery_level = battery;
  }

  const response = await axios.post(PUSH_URL, payload);
  return response.data;
}

// Usage
pushLocation(37.7749, -122.4194, 85)
  .then(result => console.log(result));

💬 Support & Resources

Need Help?

Get in touch with our developer support team or explore additional resources.

  • 📧 Email: tripqube@gmail.com
  • 📖 Full API Documentation: Coming soon
  • 💬 Developer Community: Coming soon
  • 🐛 Report Issues: Coming soon

TripQube API Documentation

← Back to Home

📡 Overview

Welcome to the TripQube Developer API Documentation. Our API allows you to integrate GPS tracking, location sharing, and real-time trip updates into your applications.

This documentation provides all the information you need to push location data from your GPS devices or applications to TripQube's tracking system.

🔑 Getting Started

Base URL: https://tripserver-hjf6a3ekha-el.a.run.app
Endpoint: /tracker/location/push
Method: POST
Content-Type: application/json

To start pushing location data, you'll need:

📋 API Parameters

Parameter Type Required Description
tracker_id string ✅ Required Your unique tracker identifier
tracker_key string ✅ Required Authentication key for the tracker
latitude number ⚠️ Conditional* GPS latitude coordinate
longitude number ⚠️ Conditional* GPS longitude coordinate
altitude number ❌ Optional Altitude in meters
speed number ❌ Optional Speed in m/s
accuracy number ❌ Optional Position accuracy in meters
heading number ❌ Optional Heading/bearing in degrees
timestamp number ❌ Optional Unix timestamp (ms or seconds)
location_buffer array ⚠️ Conditional* Array of location objects for batch update

* Either (latitude AND longitude) OR location_buffer must be provided.

💻 Integration Examples

Python

Simple Python implementation for pushing location data via HTTP.

import requests
import json
import time

# Configuration
TRACKER_ID = "your_tracker_id_here"
TRACKER_KEY = "your_tracker_key_here"
API_URL = "https://tripserver-hjf6a3ekha-el.a.run.app/tracker/location/push"

def push_location(latitude, longitude, altitude=None, speed=None, accuracy=None):
    """Push single location update to TripQube"""
    
    payload = {
        "tracker_id": TRACKER_ID,
        "tracker_key": TRACKER_KEY,
        "latitude": latitude,
        "longitude": longitude,
        "timestamp": int(time.time() * 1000)  # Current time in milliseconds
    }
    
    # Add optional parameters if provided
    if altitude is not None:
        payload["altitude"] = altitude
    if speed is not None:
        payload["speed"] = speed
    if accuracy is not None:
        payload["accuracy"] = accuracy
    
    try:
        response = requests.post(
            API_URL,
            json=payload,
            headers={"Content-Type": "application/json"}
        )
        
        if response.status_code == 200:
            print("✅ Location pushed successfully")
            return response.json()
        else:
            print(f"❌ Error: {response.status_code} - {response.text}")
            return None
    
    except Exception as e:
        print(f"❌ Exception occurred: {str(e)}")
        return None

# Example usage
if __name__ == "__main__":
    # Push a single location
    result = push_location(
        latitude=28.6139,
        longitude=77.2090,
        altitude=216,
        speed=15.5,
        accuracy=10
    )
    print(result)

JavaScript/Node.js

Example implementation for Node.js server applications.

const axios = require('axios');

// Configuration
const TRACKER_ID = 'your_tracker_id_here';
const TRACKER_KEY = 'your_tracker_key_here';
const API_URL = 'https://tripserver-hjf6a3ekha-el.a.run.app/tracker/location/push';

/**
 * Push single location update to TripQube
 */
async function pushLocation(latitude, longitude, options = {}) {
  const payload = {
    tracker_id: TRACKER_ID,
    tracker_key: TRACKER_KEY,
    latitude: latitude,
    longitude: longitude,
    timestamp: Date.now(), // Current time in milliseconds
    ...options // Include altitude, speed, accuracy, heading if provided
  };

  try {
    const response = await axios.post(API_URL, payload, {
      headers: {
        'Content-Type': 'application/json'
      }
    });

    console.log('✅ Location pushed successfully');
    return response.data;
  } catch (error) {
    console.error('❌ Error pushing location:', error.message);
    if (error.response) {
      console.error('Response:', error.response.data);
    }
    return null;
  }
}

// Example usage
(async () => {
  const result = await pushLocation(28.6139, 77.2090, {
    altitude: 216,
    speed: 15.5,
    accuracy: 10,
    heading: 90
  });
  console.log(result);
})();

💬 Support & Resources

Need Help?

Get in touch with our developer support team or explore additional resources.

  • 📧 Email: tripqube@gmail.com
  • 📖 Full API Documentation: Coming soon
  • 💬 Developer Community: Coming soon
  • 🐛 Report Issues: Coming soon