# Data

### /data/spreadsheet/parse

Parse spreadsheet file (.xlsx, .xls, .csv) and store it in internal storage.

#### Parameters

| name           | description                                                                                                                           | type        |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| file           | File to upload.                                                                                                                       | file        |
| preview\_count | Size of preview. Min=1, max=20.                                                                                                       | int         |
| parse\_header  | Parse first row as header.                                                                                                            | boolean     |
| header\_map    | If `parse_header` is `true` should contains map of matching column name to field identifier, `{"Label": "label", "Latitude": "lat"}`. | JSON object |

If `parse_header` is set to `true`, first row of the uploaded file will be treated as header corresponding to given `header_map`.

#### Response

```json
{
  "file_id": "568539",
  "header": ["header1", "header2"],
  "preview": ["preview of file 1", "preview of file 2"]
}
```

* `file_id` - string. Unique file ID.
* `header` - optional string array. List of files' headers.
* `preview` - string array. First N rows of file.

#### Errors

* 234 – Invalid data format.

### /data/import/list

Returns the list of the user's import processes.

#### Parameters

| name  | description                                                               | type         |
| ----- | ------------------------------------------------------------------------- | ------------ |
| types | Optional. Types of the imported entities, e.g. `["vehicle", "employee"]`. | string array |

#### Response

```json
{
  "success" : true,
  "list" : [ {
    "id": <int>,
    "user_id": <int>,
    "created": <date>,
    "type": <string>, // vehicle | employee
    "params": {
      "headers": [<string>, <string>,...] // List of files' headers
    },
    "filename": <string>, // Name of preloaded TSV.
    "status": <string>, // created | in_progress | done | failed
    "status_change_date": <date>,
    "progress": {
      "imported": <int>,
      "failed": <int>,
      "percent": <int>, // approximate percentage of processed
      "processed_lines": <int>,
      "warnings": [{line:<int>, error: <string>}], // first 25
      "errors": [{line:<int>, error: <string>}], // first 25
    }
  }, ...]
}
```

#### Example

cURL

```sh
curl -X POST "https://api.eu.navixy.com/v2/data/import/list" \
    -H "Content-Type: application/json" \
    -d '{"hash": "a6aa75587e5c59c32d347da438505fc3"}'
```

### /data/import/read

Returns an import process with specified ID.

#### Parameters

| name        | description                   | type   |
| ----------- | ----------------------------- | ------ |
| process\_id | Process ID                    | int    |
| type        | Type of the imported entities | string |

#### Response

```json
{
  "success": true,
  "value": {
    "id": <int>,
    "user_id": <int>,
    "created": <date>,
    "type": <string>, // vehicle | employee
    "params": {
      "headers": [<string>, <string>,...] // List of files' headers
    },
    "filename": <string>, // Name of preloaded TSV.
    "status": <string>, // created | in_progress | done | failed | finished
    "status_change_date": <date>,
    "progress": {
      "imported": <int>,
      "failed": <int>,
      "percent": <int>, // approximate percentage of processed
      "processed_lines": <int>,
      "warnings": [{line:<int>, error: <string>}], // first 25
      "errors": [{line:<int>, error: <string>}], // first 25
    }
  }
}
```

#### Example

cURL

```sh
curl -X POST "https://api.eu.navixy.com/v2/data/import/read" \
    -H "Content-Type: application/json" \
    -d '{"hash": "a6aa75587e5c59c32d347da438505fc3", "type": "employee", "process_id": 1}'
```

#### Errors

* 201 – Not found in database (if import is not found)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://navixy.com/docs/navixy-api/user-api/backend-api/resources/commons/data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
