# optimoroute-client

> A lightweight universal TypeScript WS API client for OptimoRoute. OptimoRoute plans and optimizes routes and schedules for deliveries and mobile workforce.

Latest version **1.18.1** (published 2022-10-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install optimoroute-client
pnpm add optimoroute-client
yarn add optimoroute-client
bun add optimoroute-client
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.18.1 |
| Published | 2022-10-15 |
| First published | 2020-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 143.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | rokala |
| Maintainers | rokala |
| Keywords | OptimoRoute, route, optimization, universal, TypeScript, API, client, api, client |

## Links

- npm: https://www.npmjs.com/package/optimoroute-client
- Repository: https://github.com/rokala/optimoroute-client
- Homepage: https://github.com/rokala/optimoroute-client#readme
- Issues: https://github.com/rokala/optimoroute-client/issues
- npm.io page: https://npm.io/package/optimoroute-client

## Dependencies (1)

- [isomorphic-unfetch](https://npm.io/package/isomorphic-unfetch.md) ^3.0.0

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.18.1 (latest) — 2022-10-15
- 1.1.3 — 2021-09-01
- 1.1.2 — 2021-09-01
- 1.1.1 — 2021-09-01
- 1.1.0 — 2021-09-01
- 1.0.1 — 2020-09-21
- 1.0.0 — 2020-09-17

## README

<p align="center" style="width:40%;margin:0 auto;">
<img src="https://i.imgur.com/fV5KFhV.png" alt="OptimoRoute logo">
</p>

<h3 align="center">OptimoRoute API client</h3>

<h4 align="center">A quick way to start consuming the OptimoRoute API with JavaScript or TypeScript.</h3>

## About

- Up to date with OptimoRoute API `v1.18` (the MAJOR and MINOR versions of this repository reflect the API version it supports).
- See project at [npmjs.com/optimoroute-client](https://www.npmjs.com/package/optimoroute-client).
- See [API official specifications](https://optimoroute.com/api/).

## Installation

Install via NPM

```bash
npm install optimoroute-client
```

or build it yourself

```bash
git clone https://github.com/rokala/optimoroute-client.git
cd ./optimoroute-client
npm install
npm run build
```

## Credentials

API authentication key provided by [OptimoRoute](http://optimoroute.com/) is required to use the API.

## Usage

```js
// 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:

- `success` [boolean]
- `code` [string] (*conditional*)
- `message` [string] (conditional*)

If `success === false` then `code` and `message` will give you a clue of what went wrong.

---
_Source: https://npm.io/package/optimoroute-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
