## Put articles into an EGIS shopping cart (tenant:egis-cart:write)

`POST /api/trade/v1/itsp/egis/carts/items`

Module: Trade · operationId: `addToEgisCart` · Tag: ITSP · Auth: access token (`Authorization: Bearer <accessToken>`)

A cart that does not exist yet is created (`created`). EGIS answers per position; a refused position (no quantity, invalid quantity, no distributor article, distributor article end of life) has `added false` and a German `message` and does not fail the others.

### Request body

`application/json` (required)

- `cart` (string, required): Cart name without the `(global)` prefix (at most 26 characters); created when it does not exist.
- `lines` (array of object, required): Articles to put into the cart.
  - `quantity` (integer, required): Quantity to add.
  - `comment` (string): Comment on the cart position. (max length 200)
  - `description` (string): Description of the article. (max length 100)
  - `distributorId` (string): EGIS distributor number; empty lets EGIS choose.
  - `ean` (string): EAN (GTIN) of the article. (max length 15)
  - `mpn` (string): Manufacturer part number. (max length 50)
  - `pcsNumber` (string): EGIS PCS article number.
  - `supplierArticleNumber` (string): The distributor's article number. (max length 25)

Example:

```json
{
  "cart": "Einkauf",
  "lines": [
    {
      "comment": "Mindestbestand Lager",
      "distributorId": "70044",
      "pcsNumber": "PCS400942",
      "quantity": 16
    }
  ]
}
```

### Responses

- **200** Result per position (`application/json`)
- **400** Error (`application/json`)
- **401** No valid session or bearer token (no body).
- **403** Missing permission, no active tenant in the token, or a missing CSRF token on a cookie write. (`application/json`)
- **502** A dependent service (DMS, masterdata, a distributor) failed or is unreachable. (`application/json`)
- **503** The configuration store is not available. (`application/json`)

Fields of the 200 answer:

- `label` (string): Name without the `(global)` prefix.
- `name` (string): Name in EGIS.
- `added` (integer): Number of lines added.
- `created` (boolean): The cart was new.
- `lines` (array of object): Outcome per requested line.
  - `added` (boolean): The line was added.
  - `message` (string): German reason of a refusal.
  - `pcsNumber` (string): EGIS PCS article number.
  - `position` (integer): Position of the line in the request.
  - `statusCode` (integer): 0 added, 2 no quantity, 3 invalid quantity, 4 no distributor article, 5 distributor article end of life. (one of `0`, `2`, `3`, `4`, `5`)
  - `supplierArticleNumber` (string): The distributor's article number.

Example 200 answer:

```json
{
  "added": 1,
  "created": false,
  "label": "Einkauf",
  "lines": [
    {
      "added": true,
      "pcsNumber": "PCS400942",
      "position": 1,
      "statusCode": 0,
      "supplierArticleNumber": "NL-HS-USB-ANC"
    }
  ],
  "name": "(global) Einkauf"
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/trade/v1/itsp/egis/carts/items' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"cart":"Einkauf","lines":[{"comment":"Mindestbestand Lager","distributorId":"70044","pcsNumber":"PCS400942","quantity":16}]}'
```
