Skip to content
Imports

Start validating every row of an import

Scope: importSee also:Authentication ·Errors ·Pagination ·Rate limits
POST
/imports/{importId}/validate

Editor and above, or an API key with the import scope (ADR-026). A job reads every row with the mapping, validates it with the editor's validators and finds duplicate serial numbers in the file and in the database (after removing surrounding spaces and invisible characters). Requires a serial number column and a model column or options.battery_model_id. Follow the import with getImport until its status is validated or failed.

Authorization

apiKey
headerAuthorizationBearer <token>

Organisation API key sent as Authorization: Bearer bp_live_… (ADR-017). Accepted only by the operations that list this scheme, with the scope in their x-api-key-scope.

Path Parameters

importId*string
Formatuuid

Response Body

The validation job.

application/json
  1. response

created_by names the member who started the job, created_by_api_key the API key that started an import validation (ADR-026); a job without either was started by the system (the registry re-evaluation).

created_at*string
Formatdate-time
created_by?
created_by_api_key?

An organisation API key (ADR-017) that reported an event (source api) or staged an import (ADR-026).

error_code?JobErrorCode

Why a job failed (forbidden: the member who started it lost the role or left).

Value in"forbidden""not_found""conflict""invalid""internal_error"
file?
finished_at?string
Formatdate-time
id*string
Formatuuid
import_id?string
Formatuuid
kind*JobKind
Value in"import_validate""import_commit""import_approve""bulk_publish""qr_export""registry_reevaluate""org_export"
progress*
result?

The summary of a finished job; which members are set depends on the kind.

started_at?string
Formatdate-time
status*JobStatus
Value in"queued""running""succeeded""failed"
Example Request
curl -X POST 'https://example.com/api/v1/imports/497f6eca-6276-4993-bfeb-53cbbbba6f08/validate'
Example Response
{  "created_at": "2019-08-24T14:15:22Z",  "created_by": {    "display_name": "string",    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"  },  "created_by_api_key": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string"  },  "error_code": "forbidden",  "file": {    "content_type": "string",    "expires_at": "2019-08-24T14:15:22Z",    "filename": "string",    "size": 0  },  "finished_at": "2019-08-24T14:15:22Z",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "import_id": "13230382-dadc-41f2-963d-e123bd5c0585",  "kind": "import_validate",  "progress": {    "done": 0,    "total": 0  },  "result": {    "approval": {      "approved": 0,      "not_approved": 0,      "reasons": {        "checks_failed": 0,        "conflict": 0,        "evidence_required": 0,        "four_eyes": 0,        "import_warning": 0      },      "units": 0    },    "detail": "string",    "export": {      "bytes": 0,      "files": 0,      "format": "string",      "records": {        "property1": 0,        "property2": 0      }    },    "import_summary": {      "approved": 0,      "created": 0,      "duplicates": 0,      "errors": 0,      "not_approved": 0,      "rows": 0,      "valid": 0,      "warnings": 0    },    "outcomes": {      "blocked": 0,      "exported": 0,      "failed": 0,      "published": 0,      "skipped": 0,      "unchanged": 0    },    "reevaluation": {      "checked": 0,      "registry_version": "string",      "update_needed": 0    },    "units": 0  },  "started_at": "2019-08-24T14:15:22Z",  "status": "queued"}