Socket
Socket
Sign inDemoInstall

openpaths-api

Package Overview
Dependencies
41
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    openpaths-api

A Node.js module for the OpenPaths API <https://openpaths.cc/api>


Version published
Maintainers
1
Install size
3.04 MB
Created

Readme

Source

OpenPaths-API

A Node.js module for the OpenPaths API.

This module was inspired by node-openpaths, but this one has posting functionality, and works with parameters.

Pre-requisites

You need Node.js and npm.

You also need an OpenPaths account.

Installation

$ npm install openpaths-api

Usage

View the examples on the examples/ directory for getting and posting geo points, or the examples below.

API Documentation

You can find more information over at OpenPaths' official API documentation. Since it's still pretty simple, what you need to know:

Initializing

var OpenPathsAPI = require( 'openpaths-api' ),
    openPaths = new OpenPathsAPI({
        key: 'YOUR_KEY',
        secret: 'YOUR_SECRET'
    });

Getting geo points

// Params are optional, you can call .getPoints with the callback as the first argument
var params = {
    start_time: 0, // Unix timestamp
    end_time: Math.round( new Date().getTime() / 1000 ), // Unix timestamp
    num_points: 100 // Default, allowed 0 - 2000
};

openPaths.getPoints( params, function( error, response, points ) {
    if ( error ) {
        throw new Error( JSON.stringify(error) );
    }

    console.log( points );
});

Posting geo points

var points = [
    {
        lat: 40.678238, // Latitude
        lon: -73.945789, // Longitude
        alt: 18.914, // Altitude (in meters)
        t: 1410213632 // Unix timestamp
    }
];

openPaths.postPoints( points, function( error, response, data ) {
    if ( error ) {
        throw new Error( JSON.stringify(error) );
    }

    console.log( data );// { success: 'true' }
});

Keywords

FAQs

Last updated on 09 Sep 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc