1.18.1 • Published 2 years ago

optimoroute-client v1.18.1

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

About

Installation

Install via NPM

npm install optimoroute-client

or build it yourself

git clone https://github.com/rokala/optimoroute-client.git
cd ./optimoroute-client
npm install
npm run build

Credentials

API authentication key provided by OptimoRoute is required to use the API.

Usage

// Import the module
import OptimoRoute from 'optimoroute-client';

// Initialize the client, never expose your API key to the public
const optimoRoute = new OptimoRoute({
  authKey: process.env.OPTIMO_ROUTE_API_KEY
});

// Example requests
optimoRoute.getOrders('Order_1')
  .then((response) => {
      // do stuff...
  });

optimoRoute.getOrders([
  { orderNo: 'Order_1' },
  { orderNo: 'Order_2' },
  { orderNo: 'Order_3' }
])
  .then((response) => {
     // do stuff...
  });

optimoRoute.getSchedulingInfo({orderNo = 'Order_1'})
  .then((response) => {
    // do stuff...
  });

optimoRoute.getRoutes({ date: '2021-10-01' })
  .then((response) => {
    // do stuff...
  });

optimoRoute.updateDriverParameters({ externalId: 'Driver_1', date: '2020-10-01', enabled: false })
  .then((response) => {
    // do stuff...
  });

optimoRoute.searchOrders({dateRange: {'from': '2022-10-17', 'to': '2022-10-19'}, 'includeOrderData': true})
  .then((response) => {
    // do stuff ...
  });

Common response properties

All responses include the following properties:

If success === false then code and message will give you a clue of what went wrong.