paccurate

Reduce fulfillment costs and wasted material by finding the optimal way to pack every shipment, in real time.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
paccurate
311.3.022 days agoa year agoMinified + gzip package size for paccurate in KB

Readme

paccurate
NPM
NPM version build codecov
Node.js client library for Paccurate (see demo). The types are generated from Paccurate Swagger v1.5.7.

Quick Start

import { pack } from 'paccurate'

const data = await pack({
  key: 'YOUR_API_KEY',
  itemSets: [
    {
      refId: 0,
      dimensions: { x: 5.5, y: 6, z: 6 },
      quantity: 3,
      weight: 4.5,
    },
  ],
  boxTypeSets: ['fedex'],
})

console.log(data)

Documentation

See Paccurate docs and API docs.

Prerequisites

Installation

NPM:
npm install paccurate

Yarn:
yarn add paccurate

Usage

The package needs to be configured with your account's secret key:
const { Paccurate } = require('paccurate')

const paccurate = new Paccurate('YOUR_API_KEY')

paccurate
  .pack({
    // ...
  })
  .then((data) => console.dir(data, { depth: null }))
  .catch((error) => console.error(error.code, error.message))

The same can be done with ES Modules and async-await:
import { Paccurate } from 'paccurate'

const paccurate = new Paccurate('YOUR_API_KEY')

async function main() {
  try {
    const data = await paccurate.pack({
      // ...
    })
    console.dir(data, { depth: null })
  } catch (error) {
    console.error(error.code, error.message)
  }
}

main()

API Endpoint

The request can be sent to two endpoints:
| Endpoint | Description | | ------------------------------- | --------------------------------------------------- | | https://api.paccurate.io/ | 30-second timeout, best for real-time | | https://cloud.api.paccurate.io/ | 1 hour timeout, best for large, parallel batch jobs |
The default endpoint is https://api.paccurate.io/. To send to a different endpoint, you can:
  1. Instantiate with endpoint:
```ts
import { Paccurate } from 'paccurate'

const paccurate = new Paccurate('YOUR_API_KEY', 'https://cloud.api.paccurate.io/')
await paccurate.pack(data)
```
  1. Call method with endpoint:
```ts
import { Paccurate } from 'paccurate'

const paccurate = new Paccurate('YOUR_API_KEY')
await paccurate.pack(data, 'https://cloud.api.paccurate.io/')
```
  1. Call function with endpoint:
```ts
import { pack } from 'paccurate'

await pack(data, 'https://cloud.api.paccurate.io/')
```

TypeScript

The following types can be imported:
import type { Body, Response } from 'paccurate'

Release

Release is automated with Release Please.

License

MIT