Skip to main content

Create batch orders (Excel upload)

POST 

/api/batchShipping

Creates several orders from the filled-in Excel template (GET /api/batchShipping). Each row is validated and processed separately. The response is 200 even if some rows fail: check isValid and response_message of each row in data[]. codeExcel is the row number in the Excel file, to locate the errors.

How to send the file

  • Send it as multipart/form-data in the file field, with the Excel content type (application/vnd.openxmlformats-officedocument.spreadsheetml.sheet). If the file arrives with another type (for example application/octet-stream), it is rejected. With curl: -F "file=@plantilla.xlsx;type=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".
  • Only the .xlsx format is read. An .xls file (old format) is rejected with El archivo no pudo ser leído como Excel.
  • The first sheet is read; row 1 holds the headers and empty rows are skipped.
  • Fill in the template in Excel or another spreadsheet app that saves formula results: the hidden columns calculate the IDs (address, municipality, service) from what you pick in the lists. If the file is generated with a library that does not calculate formulas, the rows fail.

Columns and per-row validations

Each row is validated in this order and only the first error is reported:

ColumnDataRuleMessage if it fails
BClient nameRequired, 2 to 150 charactersEl nombre del cliente es obligatorio y no puede estar vacío, El nombre del cliente debe contener al menos 2 caracteres, El nombre del cliente es demasiado largo. No puede superar los 150 caracteres
CClient phoneRequired, 7 to 9 characters: digits and, optionally, a hyphenEl número de teléfono del cliente es obligatorio, El número de teléfono del cliente no puede tener más de 9 caracteres. Puede ingresarse con o sin guion, El número de teléfono del cliente solo puede contener números y, opcionalmente, un guion
DShipping addressRequired, 5 to 250 charactersLa dirección del cliente es obligatoria y no puede estar vacía, La dirección del cliente es demasiado corta. Debe contener al menos 5 caracteres, La dirección del cliente es demasiado larga. No puede superar los 250 caracteres
E, FDepartment and municipalityPicked from the listNo se pudo identificar el municipio del cliente. Verifica que el municipio exista y esté correctamente seleccionado
APickup addressPicked from the listSeleccione una dirección de recolección válida
ICourierRequiredSeleccione un courier válido
JServiceRequiredSeleccione un servicio
KService typeRequired; the courier, service and type combination must exist in the listSeleccione un tipo de servicio, La combinación de courier, servicio y tipo de servicio no es válida
LDelivery typeEntrega Normal (Sin Cobro) (normal delivery, no collection) or Cobro Contra Entrega (cash on delivery)Seleccione un tipo de entrega válido
NProduct descriptionRequired, up to 150 charactersIngrese una descripción del producto, La descripción del producto es demasiado larga
HWeight (lb)Number greater than 0Ingrese un peso válido
GNumber of packagesInteger from 1 to 50Ingrese una cantidad de paquetes válida
MAmount to collectGreater than 0 with Cobro Contra Entrega; without collection, empty or greater than or equal to 0Ingrese un monto a cobrar válido, por ejemplo 15.50, El monto a cobrar no puede ser negativo
OCommentsOptional, up to 300 charactersLos comentarios son demasiado largos

What each valid row does

Saves or updates the recipient in the merchant's clients and creates the order just like POST /api/orders: it generates the shipping label and deducts the cost from the balance. If the creation fails (for example, because of the balance or a courier error), the row comes back with isValid: false and the message of that error. The other rows are still processed.

Request​

Responses​

File processed; check the result of each row