PochtaSdk 0.1.14

There is a newer version of this package available.
See the version list below for details.
dotnet add package PochtaSdk --version 0.1.14
NuGet\Install-Package PochtaSdk -Version 0.1.14
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PochtaSdk" Version="0.1.14" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PochtaSdk --version 0.1.14
#r "nuget: PochtaSdk, 0.1.14"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PochtaSdk as a Cake Addin
#addin nuget:?package=PochtaSdk&version=0.1.14

// Install PochtaSdk as a Cake Tool
#tool nuget:?package=PochtaSdk&version=0.1.14

Pochta SDK

Build status .NET Framework 4.6.2 .NET 6.0 NuGet DotNetFiddle

Pochta.ru REST API client with tracing support.

Welcome

This is an early beta version that covers only very basic API features.

Getting started

  • Add the Nuget package: https://www.nuget.org/packages/PochtaSdk
  • Use TariffClient class to calculate delivery tariffs and terms
  • Use OtpravkaClient class to register packages (requires authentication)

Sample usage

Try online: https://dotnetfiddle.net/HsS50y

var client = new TariffClient();

// optional: trace API calls to the console
// client.Tracer = Console.WriteLine;

// calculate tariff and display as plain text
var text = client.Calculate(TariffResponseFormat.Text, new TariffRequest
{
    Object = TariffObjectType.WrapperRegular,
    From = 344038,
    To = 115162,
    Weight = 100,
    Date = DateTime.Now,
    Time = "0223",
});

// display server's response
Console.WriteLine(text);

Trace log

A typical trace log looks like this:

// Calculate
-> GET https://tariff.pochta.ru/v2/calculate/tariff?json=&object=3000&from=344038&to=115162&weight=100&closed=1&date=2022-09-26T10:37:58%2b03:00&time=0223
headers: {
  X-ApiClientName = restub v0.3.6.25927
  X-ApiMethodName = Calculate
  Accept = application/json, text/json, text/x-json, text/javascript, application/xml, text/xml
}

<- OK 200 (OK) https://tariff.pochta.ru/v2/calculate/tariff?json=&object=3000&from=344038&to=115162&weight=100&closed=1&date=2022-09-26T10:37:58%2b03:00&time=0223
timings: {
  started: 2022-09-26 10:37:58
  elapsed: 0:00:00.703
}
headers: {
  Connection = keep-alive
  Access-Control-Allow-Origin = *
  Content-Length = 921
  Content-Type = application/json;charset=utf-8
  Date = Mon, 26 Sep 2022 07:37:58 GMT
  Server = nginx
}
body: {
  "version_api": 2,
  "version": "2.14.1.675",
  "caption": "Расчет тарифов",
  "id": 3000,
  "name": "Бандероль простая",
  "mailtype": 3,
  "mailctg": 0,
  "directctg": 1,
  "weight": 100,
  "date": 20220926,
  "time": 22300,
  "date-first": 20220101,
  "postoffice": [
    {
      "index": 344038,
      "tp": 1,
      "type": 3,
      "typei": 1,
      "name": "РОСТОВ-НА-ДОНУ 38",
      "regionid": 61,
      "regiono": 60701000001,
      "region-main": 1,
      "area-main": 1,
      "placeid": 39771,
      "placeo": 60701000001,
      "parent": 344999,
      "root": 344700,
      "courier": 344880,
      "pvz": 1,
      "item-check-view": 1,
      "move": 1,
      "weight-max": 20000,
      "pack-max": 99,
      "box": 344038
    }
  ],
  "transtype": 1,
  "transname": "наземно",
  "items": [
    {
      "id": "3173",
      "name": "Пересылка простой бандероли",
      "serviceon": [
        110,
        11
      ],
      "serviceoff": [
        53,
        57
      ],
      "tariff": {
        "val": 4200,
        "valnds": 5040,
        "valmark": 4200
      }
    }
  ],
  "ground": {
    "val": 4200,
    "valnds": 5040,
    "valmark": 4200
  },
  "paymark": 4200,
  "pay": 4200,
  "paynds": 5040,
  "ndsrate": 20,
  "nds": 840,
  "place": "C5-r00-7"
}

PochtaSdk versioning

The project uses Nerdbank.GitVersioning tool to manage versions.
Each library build can be traced back to the original git commit.

Preparing and publishing a new release

  1. Make sure that nbgv dotnet CLI tool is installed and is up to date
  2. Run nbgv prepare-release to create a stable branch for the upcoming release, i.e. release/v1.0
  3. Switch to the release branch: git checkout release/v1.0
  4. Execute unit tests, update the README, release notes in csproj file, etc. Commit and push your changes.
  5. Run dotnet pack -c Release and check that it builds Nuget packages with the right version number.
  6. Run nbgv tag release/v1.0 to tag the last commit on the release branch with your current version number, i.e. v1.0.7.
  7. Push tags as suggested by nbgv tool: git push origin v1.0.7
  8. Go to github project page and create a release out of the last tag v1.0.7.
  9. Verify that github workflow for publishing the nuget package has completed.
  10. Switch back to master and merge the release branch.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.2

  • net6.0

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.18.14 135 9/18/2023
0.18.8 210 3/1/2023
0.17.8 327 11/29/2022
0.16.7 312 11/26/2022
0.15.12 298 11/16/2022
0.14.6 362 11/2/2022
0.13.8 340 11/1/2022
0.12.6 368 10/28/2022
0.11.7 355 10/27/2022
0.10.12 360 10/26/2022
0.9.16 383 10/24/2022
0.8.22 385 10/20/2022
0.7.18 367 10/16/2022
0.6.7 396 10/8/2022
0.5.10 365 10/6/2022
0.4.14 371 10/5/2022
0.3.4 369 10/3/2022
0.2.6 396 9/29/2022
0.1.14 354 9/29/2022
0.0.6 412 9/26/2022

Initial beta release.