npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ru-post-api

v1.0.2

Published

Wrapper for Russian Post API

Downloads

11

Readme

Installation

npm install ru-post-api

Usage

1. otpravka

https://otpravka.pochta.ru/
Official Russian Post spec: https://otpravka.pochta.ru/specification#/main

This module allows you to manage delivery orders. With it you can:

  • create/modify/delete new orders
  • create/modify/delete batches of orders
  • download all documents you need to ship goods
  • get information about post offices (TBD)
  • manage user settings (TBD)
  • normalize address, name and phone number (TBD)
  • check unreliable recipients (TBD)

In order to use otpravka module you need authorization token and key. If you don't have them check these spec pages:

  • https://otpravka.pochta.ru/specification#/authorization-token
  • https://otpravka.pochta.ru/specification#/authorization-key

Then you need to call otpravka.auth method with them as arguments:

otpravka.auth('mytoken', 'mykey')

You can use otpravka module now.

Every method call returns a promise. On resolve it will return an object with two fields: error and data. One of them will always be null. The other one contains the result.

Example:

const otpravka = require("ru-post-api").otpravka;

otpravka.auth('mytoken', 'mykey');

(async () => {
    console.log(await otpravka.moveBatchFromArchive(["99"]));
})();

// will move specified batch from archive and print: { error: null, data: [ { 'batch-name': '99' } ] }

2. tariff

https://tariff.pochta.ru/
Official Russian Post spec: https://tariff.pochta.ru/TariffAPI.pdf

This module allows you to calculate price of delivery. This is an open API so you don't need and authorization.

Every method call returns a promise. On resolve it will return an object with two fields: error and data. One of them will always be null. The other one contains the result.

Example:

const tariff = require("ru-post-api").tariff;

(async () => {
    console.log(
		await tariff.calc({
			object: 47030,
			from: 620961,
			to: 102321,
			weight: 1000,
		})
	);
})();

// will print:
// {
//     error: null,
//     data: {
//         version: '1.13.5.396',
//         place: 'C5-8',
//         id: 47030,
//         name: 'Посылка 1 класса',
//         ground: { val: 36833, valnds: 44200 },
//         pay: 36833,
//         paynds: 44200,
//         ndsrate: 20,
//         nds: 7367,
//         ...
//     }
// }

3. delivery

https://delivery.pochta.ru/
Official Russian Post spec: https://delivery.pochta.ru/delivery_api.pdf

This module allows you to get delivery period. This is an open API so you don't need and authorization.

Every method call returns a promise. On resolve it will return an object with two fields: error and data. One of them will always be null. The other one contains the result.

Example:

const delivery = require("ru-post-api").delivery;

(async () => {
    console.log(
		await delivery.calc({
			object: 47030,
			from: 620961,
			to: 102321,
		})
	);
})();

// will print:
// {
//    error: null,
//    data: {
//        version: '1.13.5.396',
//        place: 'D_21',
//        id: 47030,
//        name: 'Посылка 1 класса',
//        delivery: { min: 4, max: 6, deadline: '20200709T000100' },
//        ...
//    }
// }

4. tracking

https://tracking.pochta.ru/
Official Russian Post spec: https://tracking.pochta.ru/specification

This module allows you to get tracking and C.O.D. information.

In order to use this module you need to get a login and a password. You can get them here. Once you got them you need to pass them with every method call.

Every method call returns a promise. On resolve it will return an object with two fields: error and data. One of them will always be null. The other one contains the result.

Example:

const tracking = require("ru-post-api").tracking;

(async () => {
	console.log(
		await tracking.getOperationHistory({
			barCode: "EF124083719RU",
			login: "mylogin",
			password: "mypassword",
		})
	);
})();

// will print:
// {
//     error: null,
//     data: [
//         {
//             AddressParameters: [Object],
//             FinanceParameters: [Object],
//             ...
//         }
//     ]
// }