Upload and validate a store clone spreadsheet

Reads a CSV or XLSX spreadsheet, checks every line and creates no store. It is the step that must pass before a batch creation runs.

The batch has one source store for the whole file: every line clones from sourceRetailerId. The contract of that source is read once per file, never once per line.

copyItems is optional and keeps on the batch what every store will copy from sourceRetailerId (same values as the single clone). GET /retailers/clones/batches/{batchId}, GET /retailers/clones/batches/open and this answer return it, so a reload of the review keeps the choice. Missing or empty creates the stores from scratch.

Per line it checks the required columns (retailerName is required and typed by the person, and suburb is required), the check digits of taxDocumentId, whether the taxDocumentId already belongs to a store of the platform (TAX_DOCUMENT_ID_ALREADY_REGISTERED, status "Loja já existe"), the optional managerEmail (INVALID_MANAGER_EMAIL), the availability of retailerName and hostName in parse-server, whether a retailerName or hostName repeats inside the file (DUPLICATE_IN_FILE on every line with the value) and whether a taxDocumentId repeats (REPEATED_IN_FILE on every line after the first, status "Loja repetida"). The same manager may appear on many lines. The platform is looked up once for the whole file. Messages are in pt-BR.

rowSummaries has one entry per line: valid tells whether the line will become a store and, for a valid managerEmail, managerUserExists tells whether the email already has a user. That is information, not an error: an existing user gets access to the new store without any email, and a missing one is created (and gets the invite email) only when the batch execution asks for createManagerUsers; otherwise the store has no manager.

A group has one batch at a time. When the group already has a batch open for review or executing, the upload answers 409 with details.batchId before validating any line; the client continues that batch or discards it first. Two uploads at the same time cannot both open a batch: the second one answers the same 409. A batch whose source store is refused is saved but not opened, so the group can upload again.

Only the valid lines will be created. Answers 201 with status: VALID, validTotal and the rowErrors of the other lines when at least one line is valid, and 422 (status: INVALID) when no line is valid or the source store is refused. A file above the row cap, with a missing required column, or in a format other than CSV and XLSX answers 422 as well, and no store is created either way.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string
required

Loja modelo do lote inteiro. Toda linha do arquivo clona dela.

string
required

Nome do arquivo enviado. A extensao decide o leitor, csv ou xlsx.

string
required

Conteudo do arquivo em base64. O corpo e JSON, e nao multipart, porque o provider declara binaryMediaTypes '/' e todo corpo chega ao Lambda ja em base64.

copyItems
array of strings, unique

Itens que toda loja do lote vai copiar da sourceRetailerId, os mesmos da loja avulsa. O lote guarda a escolha, e a execucao usa essa lista quando o POST .../run nao manda copyItems nem mode. Ausente ou vazio cria as lojas do zero. Item desconhecido ou repetido responde 400.

Responses

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json