# epx vendors

> Read and change vendors.

## epx vendors

Reads and changes vendors, the sellers of a marketplace tenant; [`epx vendor-locations`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/vendor-locations#epx-vendor-locations)
reads and changes their locations.
create and update ID (an upsert) send the JSON body of `--file`; delete ID sends none.

Its reads require the vendor.vendor_read scope.
Its writes require the vendor.vendor_manage scope.

**Command:** `epx vendors [flags]`, `epx vendors [command]`

**Flags:** only the [global flags](https://commerce-cloud-integrations.github.io/emporix-cli/commands#global-flags).

**Subcommands**

- [`epx vendors create`](#epx-vendors-create)\
  Create one vendor.
- [`epx vendors delete`](#epx-vendors-delete)\
  Delete one vendor.
- [`epx vendors get`](#epx-vendors-get)\
  Show one vendor.
- [`epx vendors list`](#epx-vendors-list)\
  List vendors.
- [`epx vendors search`](#epx-vendors-search)\
  Search vendors.
- [`epx vendors update`](#epx-vendors-update)\
  Upsert one vendor.

## epx vendors create

Create one vendor.

Creates the vendor that the JSON body of `--file` describes, shaped as
[`epx vendors get ID -o json`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/vendors#epx-vendors-get) prints one:
name (required), type (COMPANY, the default, or SUBSIDIARY), parentId (the vendor a
subsidiary belongs to), legalInfo, contactDetails (a list of contacts, each as
`{"email": ...}`, which is all Emporix keeps of one), locations (its vendor locations, each
as `{"id": ...}` or in full, as get prints it) and mixins; parentId and locations must name
items that exist (400 Bad Request, exit 1, otherwise).
Without an id, Emporix makes one, and answers with it; an id that exists already is a
conflict (exit 5).

Changes data: on a terminal, epx asks before it sends POST. `--yes` sends without
asking (required without a terminal, or with `--file` -); `--dry-run` prints the request
instead of sending it.

Requires the vendor.vendor_manage scope.

**Command:** `epx vendors create [flags]`

**Flags**

- `--dry-run`\
  Print the request instead of sending it (excludes `-o`).
- `--file <PATH>`\
  JSON request body in PATH, sent byte for byte (- reads standard input; sending it then needs `--yes`; required).
- `-o, --output <format>`\
  Format of the response: json or yaml. Default: `json`.
- `--yes`\
  Send without asking (required without a terminal, or with `--file` -).

Also takes the [global flags](https://commerce-cloud-integrations.github.io/emporix-cli/commands#global-flags).

## epx vendors delete

Delete one vendor.

Deletes the vendor ID; it sends no body.
ID is the ID that [`epx vendors list`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/vendors#epx-vendors-list) shows; an unknown one is answered as one that Emporix deleted (204 No Content).
Its subsidiaries stay and still name it as their parentId.

Deletes data, which cannot be undone.
On a terminal, epx sends DELETE only once you type ID at its prompt.
`--yes` sends without asking (required without a terminal);
`--dry-run` prints the request instead of sending it.

Requires the vendor.vendor_manage scope.

**Command:** `epx vendors delete ID [flags]`

**Flags**

- `--dry-run`\
  Print the request instead of sending it (excludes `-o`).
- `-o, --output <format>`\
  Format of the response: json or yaml. Default: `json`.
- `--yes`\
  Send without asking (required without a terminal).

Also takes the [global flags](https://commerce-cloud-integrations.github.io/emporix-cli/commands#global-flags).

## epx vendors get

Show one vendor.

Reads vendors, the sellers of a marketplace tenant. TYPE is COMPANY or SUBSIDIARY, PARENT
the vendor a subsidiary belongs to and COUNTRY the country of registration. Registration
details, contact details and locations are only in `-o json`; [`epx vendor-locations`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/vendor-locations#epx-vendor-locations) lists
the locations.

Requires the vendor.vendor_read scope.

**Command:** `epx vendors get ID [flags]`

**Flags**

- `--columns <names>`\
  Print only these columns of table and csv, in this order: comma-separated names (any case) among ID, NAME, TYPE, PARENT, LEGAL NAME, COUNTRY.
- `--no-headers`\
  Print table and csv without the header row.
- `-o, --output <format>`\
  Output format: table, json, yaml or csv (csv: the table's rows; json and yaml: the whole response). Default: `table`.

Also takes the [global flags](https://commerce-cloud-integrations.github.io/emporix-cli/commands#global-flags).

## epx vendors list

List vendors.

Reads vendors, the sellers of a marketplace tenant. TYPE is COMPANY or SUBSIDIARY, PARENT
the vendor a subsidiary belongs to and COUNTRY the country of registration. Registration
details, contact details and locations are only in `-o json`; [`epx vendor-locations`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/vendor-locations#epx-vendor-locations) lists
the locations.

Requires the vendor.vendor_read scope.

**Command:** `epx vendors list [flags]`

**Flags**

- `--columns <names>`\
  Print only these columns of table and csv, in this order: comma-separated names (any case) among ID, NAME, TYPE, PARENT, LEGAL NAME, COUNTRY.
- `--limit <n>`\
  Print at most n items; paged reads stop early where they safely can (0: every item).
- `--no-headers`\
  Print table and csv without the header row.
- `-o, --output <format>`\
  Output format: table, json, yaml or csv (csv: the table's rows; json and yaml: the whole response). Default: `table`.
- `--query <filter>`\
  Emporix q filter, passed as given, e.g. code:(A1,A2); space-separated conditions must all match (fields mostly as in `-o json`).
- `--sort <order>`\
  Emporix sort order, passed as given, e.g. code or name.en:desc,code; fields mostly as in `-o json` (Emporix may ignore an unknown one).
- `--stream`\
  Print items as JSON Lines as soon as they are checked, page by page on paged lists, reading up to 10000 pages where a list without it stops after 1000: a check failing on a later page exits 1 after the pages before it (excludes `-o`, `--columns` and `--no-headers`).

Also takes the [global flags](https://commerce-cloud-integrations.github.io/emporix-cli/commands#global-flags).

## epx vendors search

Search vendors.

Reads the vendors that an Emporix q filter finds (`--query`; without it, every vendor).
It reads and shows them as [`epx vendors list`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/vendors#epx-vendors-list) does.

Changes nothing: Emporix serves this read as POST with a JSON body, which the
flags make or `--body` gives whole.

Requires the vendor.vendor_read scope.

**Command:** `epx vendors search [flags]`

**Flags**

- `--body <FILE>`\
  Send the JSON request body in FILE as given (- reads standard input) instead of the one the other flags make.
- `--columns <names>`\
  Print only these columns of table and csv, in this order: comma-separated names (any case) among ID, NAME, TYPE, PARENT, LEGAL NAME, COUNTRY.
- `--limit <n>`\
  Print at most n items; paged reads stop early where they safely can (0: every item).
- `--no-headers`\
  Print table and csv without the header row.
- `-o, --output <format>`\
  Output format: table, json, yaml or csv (csv: the table's rows; json and yaml: the whole response). Default: `table`.
- `--query <filter>`\
  Emporix q filter, sent as given in the request body, not in the URL (empty: no filter), e.g. code:(A1,A2); space-separated conditions must all match (fields mostly as in `-o json`).
- `--sort <order>`\
  Emporix sort order, passed as given, e.g. code or name.en:desc,code; fields mostly as in `-o json` (Emporix may ignore an unknown one).
- `--stream`\
  Print items as JSON Lines as soon as they are checked, page by page on paged lists, reading up to 10000 pages where a list without it stops after 1000: a check failing on a later page exits 1 after the pages before it (excludes `-o`, `--columns` and `--no-headers`).

Also takes the [global flags](https://commerce-cloud-integrations.github.io/emporix-cli/commands#global-flags).

## epx vendors update

Upsert one vendor.

Replaces the vendor ID with the JSON body of `--file`, shaped as create takes it
but without an id, or creates it with that id where none exists (an upsert); it requires
name and type.
With metadata.version as [`epx vendors get ID -o json`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/vendors#epx-vendors-get) prints it, Emporix
replaces it only if nobody changed it since, and answers 409 Conflict (exit 5) otherwise;
without metadata.version, it replaces it whatever its version.
ID is the ID that [`epx vendors list`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/vendors#epx-vendors-list) shows.

Changes data: on a terminal, epx asks before it sends PUT. `--yes` sends without
asking (required without a terminal, or with `--file` -); `--dry-run` prints the request
instead of sending it.

Requires the vendor.vendor_manage scope.

**Command:** `epx vendors update ID [flags]`

**Flags**

- `--dry-run`\
  Print the request instead of sending it (excludes `-o`).
- `--file <PATH>`\
  JSON request body in PATH, sent byte for byte (- reads standard input; sending it then needs `--yes`; required).
- `-o, --output <format>`\
  Format of the response: json or yaml. Default: `json`.
- `--yes`\
  Send without asking (required without a terminal, or with `--file` -).

Also takes the [global flags](https://commerce-cloud-integrations.github.io/emporix-cli/commands#global-flags).
