3.1.1 • Published 9 months ago

@rantalainen/netvisor-api-client v3.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

netvisor-api-client

Third party Netvisor API client.

:warning: This tool is work in progress and is still missing many API end points.

Installation

Install from npm:

npm install @rantalainen/netvisor-api-client

Setup

Import

import { NetvisorApiClient } from '@rantalainen/netvisor-api-client';

Setup client

  • integrationName Name for integration that is visible in Netvisor UI (self defined)
  • customerId consult Netvisor (Header: X-Netvisor-Authentication-CustomerId)
  • customerKey consult Netvisor
  • partnerId consult Netvisor (Header: X-Netvisor-Authentication-PartnerId)
  • partnerKey consult Netvisor
  • organizationId Oganization id for company

Since v0.14.0 allows using cacheable-lookup with either internal or external dns cache. Make sure you are using cacheable-lookup@5 which is compatible with got@11 that is used.

const netvisor = new NetvisorApiClient({
  integrationName: '',
  customerId: '',
  customerKey: '',
  partnerId: '',
  partnerKey: '',
  organizationId: '1234567-8'

  // optional - set to true if you want to use internal cache within Netvisor API Client
  dnsCache: dnsCache
});

Methods

All the methods will follow Visma Netvisor's integration resources. Methods are divided by category and there is also general methods for handling the raw xml data. More methods are added with future versions. If there is a method you need but it's not yet supported in the v2 api client, use previous versions of the api client or use one of the general xml methods. You can find currently implemented methods from Added methods.

You can reference Netvisor's integration documentation for more info about certain resource/method and their properties.

Edit methods

Some resources support editing with parameter { method: 'edit' }. When editing some resources in Netvisor, you will only need to pass those attributes that are to be changed and not the whole object from scratch. This is why some interfaces have all the attributes set as optional. You can always refer to Netvisor's documentation to see what attributes are actually required for certain resources.

General methods

With these methods, you can call any resource you want but the result and input data will be xml string.

// Each resource category has saveByXmlData() method (example with product)
const data = `<root>
  <product>
    <productbaseinformation>
      <productcode>CC</productcode>
      <productgroup>Books</productgroup>
      <name>Code Complete 2</name>
      <unitprice type="net">42,5</unitprice>
      <unit>pcs</unit>
      <isactive>1</isactive>
      <issalesproduct>1</issalesproduct>
      <inventoryenabled>1</inventoryenabled>
    </productbaseinformation>
    <productbookkeepingdetails>
      <defaultvatpercentage>24</defaultvatpercentage>
    </productbookkeepingdetails>
  </product>
</root>`;
await netvisor.product.saveByXmlData('product.nv', data, { method: 'add' });

// Each resource category has getXmlData() method to get the raw xml data as a string (example with sales invoice)
const xmlString = await netvisor.sales.getXmlData('getsalesinvoice.nv', { netvisorkey: '123', showcommentlines: '1' });

Added methods

ClassMethodNetvisor resourceAdded
accountingaccountingLedger()accountingledger.nv2.1.0
accountingaccounting()accounting.nv2.1.0
accountingaccountList()accountlist.nv2.5.0
accountingvoucherTypeList()vouchertypelist.nv2.5.0
customerscustomerList()customerlist.nv2.0.0
customersgetCustomer()getcustomer.nv2.0.0
customerscustomer()customer.nv2.0.0
customerssalesPersonnelList()salespersonnellist.nv2.5.0
customersoffice()office.nv3.1.0
customerscontactPerson()contactperson.nv3.1.0
dimensionsdimensionList()dimensionlist.nv2.0.0
dimensionsdimensionItem()dimensionitem.nv2.1.0
dimensionsdimensionDelete()dimensiondelete.nv2.1.0
paymentssalesPaymentList()salespaymentlist.nv2.0.0
paymentspayment()payment.nv2.2.0
paymentssalesPayment()salespayment.nv2.5.0
payrollpayrollPeriodCollector()payrollperiodcollector.nv2.2.0
payrollgetEmployees()getemployees.nv2.3.0
payrollgetEmployee()getemployee.nv2.3.0
payrollgetPayrollPaycheckBatchList()getpayrollpaycheckbatchlist.nv2.3.0
payrollgetPayrollPaycheckBatch()getpayrollpaycheckbatch.nv2.3.0
payrollemployee()employee.nv2.4.0
payrollpatchEmployee()patchemployee.nv2.4.0
payrollgetEmployeeSalaryParameters()getemployeesalaryparameters.nv2.4.0
payrollemployeeSalaryParameters()employeesalaryparameters.nv2.4.0
payrollpayrollRatioList()payrollratiolist.nv2.4.0
payrollpayrollExternalSalaryPayment()payrollexternalsalarypayment.nv2.4.0
payrolladdJobPeriod()addjobperiod.nv2.4.0
payrolleditJobPeriod()editjobperiod.nv2.4.0
payrolldeleteJobPeriod()deletejobperiod.nv2.4.0
payrollattachEmployeeToSettlementPoint()attachemployeetosettlementpoint.nv2.4.0
payrollgetPayrollParties()getpayrollparties.nv2.4.0
payrollpayrollPaycheckBatch()payrollpaycheckbatch.nv2.4.0
payrollpayrollAdvance()payrolladvance.nv2.4.0
productsproductList()productlist.nv2.1.0
productsgetProduct()getproduct.nv2.1.0
productsproduct()product.nv2.1.0
productsextendedProductList()extendedproductlist.nv2.1.0
productsinventoryByWarehouse()inventorybywarehouse.nv2.2.0
productswarehouseEvent()warehouseevent.nv2.2.0
productsgetInventoryPlaces()getinventoryplaces.nv2.5.0
purchasesgetVendor()getvendor.nv2.2.0
purchasesvendor()vendor.nv2.5.0
purchasespurchaseInvoice()purchaseinvoice.nv2.2.0
purchasespurchaseInvoiceList()purchaseinvoicelist.nv2.3.0
purchasesgetPurchaseInvoice()getpurchaseinvoice.nv2.3.0
purchasespurchaseOrder()purchaseorder.nv2.3.0
purchasespurchaseOrderList()purchaseorderlist.nv2.4.0
purchasesgetPurchaseOrder()getpurchaseorder.nv2.4.0
salessalesInvoiceList()salesinvoicelist.nv2.0.0
salesgetSalesInvoice()getsalesinvoice.nv2.0.0
salesgetSalesOrder()getorder.nv2.0.1
salessalesInvoice()salesinvoice.nv2.0.0
salesupdateSalesInvoiceStatus()updatesalesinvoicestatus.nv2.6.0
workdaytripExpense()tripexpense.nv2.2.0
workdayworkday()workday.nv2.2.0
workdaygetRecordTypeList()getrecordtypelist.nv2.7.0

Examples

// Get full customer info from customer that has id 123
const customer = await netvisor.customers.getCustomer({ id: 123 });
// Get all the dimensions including hidden ones
const dimensions = await netvisor.dimensions.dimensionList({ showhidden: 1 });
// Get all the sales payments
const payments = await netvisor.payments.salesPaymentList();
// Add a new invoice to Netvisor
const netvisorKey = await netvisor.sales.salesInvoice(salesInvoice, { method: 'add' });
// Edit sales invoice that is already in Netvisor
await netvisor.sales.salesInvoice(editedSalesInvoice, { method: 'edit', id: 123 });
3.1.1

9 months ago

3.1.0

11 months ago

3.0.0

1 year ago

2.8.0

1 year ago

2.7.0

1 year ago

2.6.1

1 year ago

2.6.0

1 year ago

2.5.4

2 years ago

2.5.3

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

2.0.2

2 years ago

2.4.1

2 years ago

2.4.0

2 years ago

2.2.2

2 years ago

2.4.3

2 years ago

2.4.2

2 years ago

2.4.5

2 years ago

2.4.4

2 years ago

2.0.1

2 years ago

2.3.0

2 years ago

2.5.0

2 years ago

2.5.2

2 years ago

2.5.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

0.15.0

2 years ago

0.16.0

2 years ago

0.14.0

3 years ago

0.11.0

3 years ago

0.12.0

3 years ago

0.13.0

3 years ago

0.12.1

3 years ago

0.13.1

3 years ago

0.10.0

3 years ago

0.9.0

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.7

3 years ago

0.6.6

3 years ago

0.6.5

3 years ago

0.6.4

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.6.0

3 years ago

0.5.1

3 years ago

0.3.0

3 years ago

0.2.1

3 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.0.20

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.0.19

4 years ago

0.0.18

4 years ago