# xentral-node-api

> Node module to access Xentral API

Latest version **2.0.1** (published 2021-11-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install xentral-node-api
pnpm add xentral-node-api
yarn add xentral-node-api
bun add xentral-node-api
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2021-11-30 |
| First published | 2021-08-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 16.7 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Denis Ciccale |
| Maintainers | denis, evgdema, dubkrapht, deepalig25 |
| Keywords | xentral, api |

## Links

- npm: https://www.npmjs.com/package/xentral-node-api
- Repository: https://github.com/zenfulfillment/xentral-node-api
- Homepage: https://github.com/zenfulfillment/xentral-node-api#readme
- Issues: https://github.com/zenfulfillment/xentral-node-api/issues
- npm.io page: https://npm.io/package/xentral-node-api

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.24.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## Recent versions

- 2.0.1 (latest) — 2021-11-30
- 2.0.0 — 2021-11-26
- 1.0.0 — 2021-08-30

## README

# xentral node api

- [REST-API docs](https://update.xentral.biz/apidoc/docs211.html)
- [Standard-Api docs](https://help.xentral.com/hc/de/articles/360017436919-API-Dokumentation)

## Usage

```js
const xentral = require('xentral-node-api')({
  url: 'https://your-api-url.example',
  user: 'your-api-username',
  pass: 'your-api-password'
});

// Request orders
const res = await xentral.get('belege/auftraege');
```

## Options

`Xentral(url, user, pass, version = 'v1')`

- `url` **required**, string - Url of your Xentral API
- `user` **required**, string - User of your Xentral API
- `pass` **required**, string - Password of your Xentral API
- `version` optional, string - API version - example: `'v1'` (default)

## Examples

### get

`xentral.get(endpoint, params)`

- `endpoint` **required**, string example: `'belege/auftrage'`
- `params` optional, object example: `{include: 'positionen'}` - will serialize to `?include=positionen`
- `api` optional, string example: either `'rest'` (default) or `'standard'`
- `type` optional, string example: either `'json'` (default) or `'xml'`

---

```js
const res = await xentral.get('belege/auftraege', {include: 'positionen'});
```

---

### post

`xentral.post(endpoint, data, api, type)`

- `endpoint` **required**, string example: `'trackingnummern'`
- `data` optional, object example: `{key: 'value'}`
- `api` optional, string example: either `'rest'` (default) or `'standard'`
- `type` optional, string example: either `'json'` (default) or `'xml'`

---

```js
// Using default api 'rest' and type 'json'
const res = await xentral.post('trackingnummern', {
  tracking: 'Test-tracking-123i12937',
  auftrag: '200001',
  anzahlpakete: 1,
  gewicht: 0.1,
  versendet_am: '2021-11-23'
});

// Using api 'standard' and type 'xml'
const xml = `<xml>
  <nummer>7000004</nummer>
  <lager_platz>HL001B</lager_platz>
  <lager_menge>22</lager_menge>
</xml>`;

const res = await xentral.post('ArtikelEdit', xml, 'standard', 'xml');

// Using api 'standard' and default type 'json'
const data = {
  nummer: 7000004,
  lager_platz: 'HL001B',
  lager_menge: 22
};

const res = await xentral.post('ArtikelEdit', data, 'standard');
```

---

### put

`xentral.put(endpoint, data)`

- `endpoint` **required**, string example: `'trackingnummern'`
- `params` optional, object example: `{include: 'positionen'}`

---

```js
const data = {
  tracking: 'Test-tracking-123i12937',
  versendet_am: '2021-11-23',
  anzahlpakete: 2
};

const res = await xentral.put('trackingnummern', data);
```

---

### del

`xentral.del(endpoint)`

- `endpoint` **required**, string example: `'adressen/10'`

---

```js
const res = await xentral.del('adressen/10');
```

---

Author: Denis Ciccale

Liecense: https://denis.mit-license.org/

---
_Source: https://npm.io/package/xentral-node-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
