Skip to content

MngReportLeadsImport

Reports the result of a leads import to the server.

An import is performed by the interface: it reads the file and creates the records one by one with MngAddLead. The server sees separate creations and does not know that they belong to one import, when it ended or how many rows failed. The interface therefore reports the result with this command once, when the import ends, including an import stopped by the user.

The command does not change any data. When the report contains failed rows the manager who sent it gets a CUSTOMER_IMPORT_FAILED notification, see NotifyRecord. A report without failed rows produces no notification.

The command is available through the manager command API only; there is no REST path for it. The kind is fixed by the command name. The command for the other kind is MngReportClientsImport.

Access Control

Allowed sessions:

  • SESSION_MANAGER
  • SESSION_ADMIN
  • SESSION_DEALER
  • SESSION_CRM_MANAGER
  • SESSION_CRM_ADMIN

The caller must have CRM access and set_leads, the permission required to create the records being imported. The manager who ran the import is taken from the session and cannot be passed in the request.

Request

Field Type Required Description
total int Yes Number of processed rows. 0 or more
created int Yes Number of created records. 0 or more
failed int Yes Number of rows that failed. 0 or more
errors array of strings No Texts of the first errors. The server keeps at most 10 items and at most 200 bytes of each; other items and non-string items are ignored

created + failed must not exceed total.

{
  "command": "MngReportLeadsImport",
  "extID": "1",
  "data": {
    "total": 250,
    "created": 247,
    "failed": 3,
    "errors": [
      "Row 14: email: Invalid email",
      "Row 97: RET_DUPLICATE_RECORD",
      "Row 180: desk: INVALID_DESK"
    ]
  }
}

Response Data

{
  "data": "OK"
}

Errors

HTTP Error Description
400 INVALID_DATA Request validation failed, or created + failed exceeds total
403 RET_NOT_ENOUGH_RIGHTS Missing permission or missing scope
403 FORBIDDEN The manager cannot be resolved from the session

Every error carries a message field with free-form text. Its contents are not part of the contract; branch on error.