122 lines
4.0 KiB
Markdown
122 lines
4.0 KiB
Markdown
# `GET /article/get`
|
|
|
|
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
|
|
|
Full article detail by **exact** match. Use after the user picks a row from [`GET /article/search`](search.md).
|
|
|
|
## Query parameters
|
|
|
|
| Param | Required | Description |
|
|
|-------|----------|-------------|
|
|
| `target` | yes | Exact article number (`cArtNr`), packaging EAN (`tGebinde.cEAN`), or barcode (`cBarcode`). |
|
|
|
|
## Response `200`
|
|
|
|
```json
|
|
{
|
|
"article": {
|
|
"kArtikel": 49,
|
|
"cArtNr": "42000044",
|
|
"cName": "BioBizz AllMix Peat Free 20L",
|
|
"cAktiv": "Y",
|
|
"fVKNEtto": 11.3445378151261,
|
|
"kSteuerklasse": 1,
|
|
"fBestand": null,
|
|
"cHersteller": null,
|
|
"cBarcode": null,
|
|
"KATs": [{ "kKategorie": 16 }, { "kKategorie": 39 }],
|
|
"lief": [],
|
|
"staffel": [],
|
|
"EANs": [],
|
|
"merkmale": [],
|
|
"attribute": []
|
|
}
|
|
}
|
|
```
|
|
|
|
The object is enriched with related data in parallel. Fields below are always present on success; arrays may be empty.
|
|
|
|
### Core fields
|
|
|
|
| Field | Type | Notes |
|
|
|-------|------|-------|
|
|
| `kArtikel` | number | Internal ID |
|
|
| `cArtNr` | string | Article number |
|
|
| `cName` | string | Name |
|
|
| `cBeschreibung` | string | Long description (HTML) |
|
|
| `cKurzBeschreibung` | string | Short description |
|
|
| `cAktiv` | string | `"Y"` or `"N"` |
|
|
| `fVKNEtto` | number | Net sales price |
|
|
| `kSteuerklasse` | number | `1` / `2` / `3` |
|
|
| `fUVP` | number | RRP |
|
|
| `fBestand` | number \| null | Stock warehouse 1 |
|
|
| `fGewicht` | number | Weight |
|
|
| `cBarcode` | string \| null | |
|
|
| `cHersteller` | string \| null | Manufacturer name |
|
|
| `cAnmerkung` | string | Internal note |
|
|
| `kVersandklasse` | number | Shipping class ID |
|
|
| `tVersandklassecName` | string | Shipping class name |
|
|
| `nIstVater` | number | `1` if parent article with variants |
|
|
| `kVaterArtikel` | number | Parent article ID (variants) |
|
|
| `kStueckliste` | number | Bill-of-materials ID; `0` if none |
|
|
| `kEigenschaftKombi` | number | Variant combination |
|
|
| `cEigenschaftName` | string \| null | Variant property name |
|
|
| `cEigenschaftWertName` | string \| null | Variant value name |
|
|
| `cLiefArtNr96` | string \| null | Supplier 96 article number |
|
|
| `nVPE` | number | Sales unit flag |
|
|
| `kMassEinheit` | number \| null | Unit of measure |
|
|
| `fMassMenge` | number | Unit quantity |
|
|
| `shops` | number \| null | Shop bitmask sum |
|
|
| `garage` | number \| undefined | Extra storage slot 0 qty |
|
|
| `keller` | number \| undefined | Extra storage slot 1 qty |
|
|
| `cHerstellerGPSR` | string \| null | Manufacturer GPSR text |
|
|
| `herstellerBild` | string \| null | Manufacturer logo, base64 PNG |
|
|
|
|
### Related arrays / objects
|
|
|
|
| Field | Description |
|
|
|-------|-------------|
|
|
| `children` | Variant rows (when `nIstVater === 1`) |
|
|
| `vater` | Parent `{ cArtNr }` (when variant) |
|
|
| `liste` | Stückliste / BOM components |
|
|
| `fAndereLager` | Stock in other warehouses `[{ fSumme }]` |
|
|
| `EANs` | `[{ cEAN }]` |
|
|
| `KATs` | `[{ kKategorie }]` |
|
|
| `lief` | Suppliers; `cAnmerkung` may be parsed into `anmerkung` |
|
|
| `incoming` | Open supplier purchase orders |
|
|
| `orders` | Open incidents (`order_count`, `order_label`, `order_free`) |
|
|
| `merkmale` | Features `[{ kMerkmal, cName, cWert, … }]` |
|
|
| `attribute` | Custom attributes |
|
|
| `staffel` | Tier prices `[{ menge, fVKBrutto }]` — brutto pre-formatted string |
|
|
|
|
### Supplier row (`lief[]`)
|
|
|
|
| Field | Notes |
|
|
|-------|-------|
|
|
| `kLieferant`, `cFirma` | Supplier |
|
|
| `cLiefArtNr` | Supplier article number |
|
|
| `nStandard` | Preferred supplier flag |
|
|
| `fEKNetto`, `fMwSt` | Purchase price / VAT |
|
|
| `fLagerbestand` | Supplier stock |
|
|
| `cEmail`, `cAnmerkung` | Contact / note |
|
|
|
|
## Errors
|
|
|
|
| Status | Body |
|
|
|--------|------|
|
|
| 400 | `{ "error": "Query parameter \"target\" is required" }` |
|
|
| 401 | `{ "error": "Unauthorized" }` |
|
|
| 404 | `{ "error": "Article not found" }` |
|
|
| 500 | `{ "error": "..." }` |
|
|
|
|
## Example
|
|
|
|
```js
|
|
// User selected cArtNr from search results
|
|
const res = await fetch(
|
|
'http://localhost:4208/api/article/get?target=42000044',
|
|
{ credentials: 'include' }
|
|
);
|
|
const { article } = await res.json();
|
|
```
|