1.1.0 β€’ Published 2 years ago

api-novaposhta v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

API NovaPoshta

πŸ‘€ Provides easy access to api novaposhta. API has 6 controllers which is got from Official Documentation. Also each of controller has own methods that are listed below.

πŸ“– Table of Contents

🧰 Setup

Installing by npm

npm install api-novaposhta

Installing by yarn

yarn add api-novaposhta

πŸ•Ή Controllers

  • πŸ“¦ [Internet Document](https://devcenter.novaposhta.ua/docs/services/556eef34a0fe4f02049c664e) - methods for receiving information about waybills.
  • 🏑 [Address](https://devcenter.novaposhta.ua/docs/services/556d7ccaa0fe4f08e8f7ce43) - it's help you work with addresses of counterparty, cities or streets where has novaposhta.
  • πŸ₯Έ [Counterparty](https://devcenter.novaposhta.ua/docs/services/557eb8c8a0fe4f02fc455b2d) - easy way to control counterparty in account.
  • πŸ›  [Common](https://devcenter.novaposhta.ua/docs/services/55702570a0fe4f0cf4fc53ed) - ways to receive common data for options to other methods.
  • βš™οΈ Service - services as redelivery, backward or change information in account.
    • [Redelivery](https://devcenter.novaposhta.ua/docs/services/58f722b3ff2c200c04673bd1)
    • [Backward](https://devcenter.novaposhta.ua/docs/services/58ad7185eea27006cc36d649)
    • [Change Information](https://devcenter.novaposhta.ua/docs/services/59eef733ff2c200ce4f6f904)
  • πŸ—ƒ [Registry](https://devcenter.novaposhta.ua/docs/services/55662bd3a0fe4f10086ec96e) - better way to working with internet document in registry.

β›“ Methods

πŸ”’ Designation that you need an api key for a method or controller 1. Internet Document πŸ”’

  • getListDocument - get list of internet document in account
  • getParcelDeliveryDate - get forecast about delivery date
  • getParcelPrice - get parcel price from entered params
  • createDocument - create a internet document
  • deleteDocument - delete internet document
  • generateReport - generate report of all internet documents
  • updateDocument - update information in internet document
  • getStatusDocuments - get status of internet document(s)
  • getTrackingInfo - get tracking information about internet document
  • getTrackingHistory - get tracking history where the parcel passed
  1. Address
    • πŸ”’ getSettlements - get settlements where has novaposhta
    • πŸ”’ getAreas - get areas by params in Ukraine
    • πŸ”’ getCities - same as getAreas but for cities
    • searchCity - search city with branch by params in request
    • πŸ”’searchStreet - same as searchCity but for street
    • πŸ”’ getWarehouses - get branches in Ukraine or by params in request
    • πŸ”’ getWarehouseStreet - get branches in Ukraine by name street
    • πŸ”’ deleteContractorAddress - delete counterparty address
    • πŸ”’ createContractorAddress - create counterparty address
    • πŸ”’ updateContractorAddress - update existed counterparty address
  2. Counterparty πŸ”’
    • getCounterpartyAddresses - get counterparty addresses in account
    • getCounterpartyOptions - get options for create internet document with additional service
    • getCounterpartyContactPerson - get contacts of counterparty in account
    • getCounterparties - get list of counterparties
    • updateContactPerson - update contacts of counterparty
    • updateCounterparty - update information about counterparty
    • createContactPerson - create contact for counterparty
    • createCounterparty - create counterparty
    • createLegalCounterparty - create counterparty for legal entity
    • createThirdPersonCounterparty - create counterparty for third person
    • deleteContactPerson - delete contact for counterparty
    • deleteCounterparty - delete counterparty
  3. Common
    • getTimeIntervals - get time intervals for service time intervals in internet document
    • πŸ”’ getCargoTypes - get types of cargo for create internet document
    • πŸ”’ getBackwardDeliveryCargoTypes - same as getCargoTypes but for service backward delivery
    • πŸ”’ getPalletsList - get list of pallets
    • πŸ”’ getPayersType - get types of payers who could pay
    • πŸ”’ getRedeliveryPayersType - same as getPayersType but for service redelivery
    • getPackList - get list of packs for create internet document
    • πŸ”’ getTiresWheelsList - get dimensions and other info about wheels
    • πŸ”’ getCargoDescriptionList - get details about cargo type
    • πŸ”’ getMessageCodeText - get descriptions of codes from request
    • πŸ”’ getServiceTypes - get types of service
    • πŸ”’ getTypesOfCounterparties - get types of counterparties
    • πŸ”’ getPaymentForms - get types of payments
    • πŸ”’ getOwnershipFormsList - get list of ownership
  4. Service πŸ”’
    • canCreateRequest - check possibility using one of services
    • createServiceRequest - create request to one of services
    • deleteServiceRequest - delete request one of services
    • getListServiceRequests - get list of services which is api provide
  5. Registry πŸ”’
    • addDocumentToRegistry - add internet document to registry
    • getRegistryInfo - get all information about registry in account
    • getListRegistryInfo - same as getRegistryInfo but returns list
    • deleteRegistry - delete registry in account
    • deleteDocumentFromRegistry - delete internet document from registry

πŸ“ Examples

Options Base API

{
   "apiKey": "<YOUR_API_KEY>",
   "apiUrl": "<YOUR_API_URL>",
   "formatResponse": "json or xml"
}

Using API Controllers

All controllers are accepted base api options. Example below is shown using for address api and get areas method in two variants.

Classic Variant

In this variant you can import and use each of one controllers as individual class with own methods.

const api = new ApiAddress({
   apiKey: '<API_KEY>',
});
await api.getAreas();

Modern Variant

But in this variant you don't need to import extra controllers, you only need a main controller and using method get with param as api controller class and after all, access to methods will be allowed.

const api = new NovaPoshta({
   apiKey: '<API_KEY>',
});
await api.get(ApiAddress).getAreas();

Some methods in api has options, in that nothing too hard, all options have types declared for better understanding and avoid mistake for using methods.

Using method without params

const api = new ApiAddress({    
  apiKey: '<API_KEY>',    
});  
await api.getAreas();  

Using method with params

const api = new NovaPoshta({
   apiKey: '<API_KEY>',
});
await api.get(ApiAddress).getCities({
   FindByString: 'Kiev',
});  
1.1.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago