Retrieving Device Locations

This section demonstrates how to retrieve the location history of a specific device using the Pulsetracker API.

GET https://www.pulsestracker.com/api/devices/{device}/locations

Query Parameters:

  • per_page: (optional) Number of results per page.

    • Type: Integer

    • Default: 50

  • page: (optional) Specifies the page of results.

    • Type: Integer

    • Default: 1

Response Details

  • The response contains the location history for the specified device.

  • Results are sorted in descending order (most recent locations first).

  • The amount of historical data retrievable depends on your subscription plan.

Example request

const url = 'https://www.pulsestracker.com/api/devices/{device}/locations';
const options = {
  method: 'GET',
  headers: {Accept: 'application/json', Authorization: 'Bearer 123'}
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}

Example response

{
  "data": [
    {
      "id": 0,
      "ip_address": "string",
      "location": {
        "type": "string",
        "coordinates": {
          "lat": 0,
          "long": 0
        }
      },
      "extra_data": {
        "property1": "string",
        "property2": "string"
      },
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "meta": {
    "current_page": 0,
    "from": 0,
    "last_page": 0,
    "links": [
      {
        "url": "string",
        "label": "string",
        "active": true
      }
    ],
    "path": "string",
    "per_page": 0,
    "to": 0,
    "total": 0
  },
  "links": {
    "first": "string",
    "last": "string",
    "prev": "string",
    "next": "string"
  }
}
Updated on