@dpdcz/geoapi-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

@dpdcz/geoapi-sdk

This is a public JS SDK with TS typings for the DPD GeoAPI.

The DPD GeoAPI is designed for DPD customers that wish to directly create shipments, print labels, order shipment pickups and manipulate other shipment related entities and processes.

Prerequisites

To use the API you will have to provide an API Key.

To obtain the API Key, you will first have to contact the designated DPD department.

Usage

import { createGeoAPIRestClient } from '@dpdcz/geoapi-sdk';

// You can change the 'production' parameter to 'test' to run the queries against the "test" environment
// Note that the "test" environment will use a different API key than the "production" environment
const sdkClient = createGeoAPIRestClient('your_api_key', 'production')

let response = await sdkClient.createShipments([
        {
                customer: {
                        ident: 'your_customer_dsw',
                },
                parcels: [{
                        // Note: This input is optional
                        parcelNumber: '00000000000001'
                }],
                // More examples later on
                ...
        },
])

if (response.status !== 200) {
        // Handle errors
        ...
}

response = await sdkClient.printParcelLabels(parcelNumber, 'RAW')

if (response.status !== 200) {
        // Handle errors
        ...
}

Examples

Code examples of the API usage can be found in the src/examples folder

Different environments

The SDK supports two pre-configured GeoAPI environments.

const sdkClient = createGeoAPIRestClient('your_api_key', 'production')
const sdkClient = createGeoAPIRestClient('your_api_key', 'test')
  • Production - Actions done via the API will be propagated to the internal DPD systems for processing. This environment is supposed to be used for your production environment only.
  • Test - Actions done via the API will not be propagated to the internal DPD systems. You can consider this environment your "safe space", test the API calls as much as need. You can use this when you want to test your integration before the production deployment. This environment can also be used for testing new features or API changes.

GeoAPI Documentation

The full GeoAPI documentation can be found here.

Source distribution

If you wish to transpile the library yourself, for whatever reason, we also provide the source distribution of this SDK.

import { createGeoAPIRestClient } from '@dpdcz/geoapi-sdk/src';

const sdkClient = createGeoAPIRestClient('your_api_key', 'production')

Readme

Keywords

Package Sidebar

Install

npm i @dpdcz/geoapi-sdk

Weekly Downloads

9

Version

0.1.2

License

MIT

Unpacked Size

74.7 kB

Total Files

117

Last publish

Collaborators

  • dpd-qest