> For the complete documentation index, see [llms.txt](https://docs.fieldmotion.com/fieldmotion-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fieldmotion.com/fieldmotion-api-docs/assets/_import.md).

# \_import

Imports the data of an Asset.

### Parameters

map

The format to determine how information will be integrated.

rows

The Asset data to be imported.

### Example

```
FM_api('Assets_import',[
    'map' => '[{"from":"ID","to":"asset_id","filter":"","options":"","idx":0},{"from":"Asset Name","to":"asset_name","filter":"","options":"","idx":0},{"from":"Book ID","to":"book_id","filter":"","options":"","idx":0},{"from":"Serial Number","to":"code","filter":"","options":"","idx":0},{"from":"Type","to":"type","filter":"","options":"","idx":0},{"from":"Location","to":"location","filter":"","options":"","idx":0},{"from":"Location Type","to":"location_type","filter":"","options":"","idx":0},{"from":"Owner","to":"owner_id","filter":"","options":"","idx":0},{"from":"Active Status","to":"active","filter":"","options":"","idx":0},{"from":"Archived Status","to":"archived","filter":"","options":"","idx":0},{"from":"Make","to":"make","filter":"","options":"","idx":0},{"from":"Model","to":"model","filter":"","options":"","idx":0},{"from":"Value","to":"value","filter":"","options":"","idx":0}]',
    'rows' => '[["60001","test asset","12345","23465","Vehicle","","",90002,"1","0","7980","6457",""],["60002","a","a","a","Vehicle","","Area",60001,"1","0","a","a",""]]'
    ]
);
```

### Results

#### On Success

```
{"ok":1,"errors":[],"ids":[60001,60002]}
```

#### On Failure

If the "map" parameter is not set:

```
{"error":"missing or invalid parameter: map"}
```

If the "rows" parameter is not set:

```
{"error":"missing or invalid parameter: rows"}
```

These errors below can apply to specific Assets imported, when certain fields of their fail to be imported:

If the Book ID of an Asset is longer than 32 characters:

```
{"ok":1,"errors":[[0,[{"msg":"Book ID too long. Max length 32","val":"123455555555555555555555555555555555555555555555555555555555555555555555555"}]]],"ids":[0,60002]}
```

If the Make of an Asset is longer than 45 characters:

```
{"ok":1,"errors":[[0,[{"msg":"Make too long. Max length 45","val":"79800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}]]],"ids":[0,60002]}
```

If the Model of an Asset is longer than 45 characters:

```
{"ok":1,"errors":[[0,[{"msg":"Model too long. Max length 45","val":"645700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}]]],"ids":[0,60002]}
```

If the Asset Type assigned to an Asset is considered invalid:

```
{"ok":1,"errors":[[0,[{"msg":"Invalid Asset Type","val":0}]]],"ids":[0,60002]}
```

If the Home Location Type of an Asset is invalid:

```
{"ok":1,"errors":[[0,[{"msg":"Invalid Home Location Type","val":"test asset"}]]],"ids":[0,0]}
```

If the format of the Next Service Date for an Asset is invalid:

```
{"ok":1,"errors":[[0,[{"msg":"Invalid format for next service date","val":"Invalid date"}]]],"ids":[0,0]}
```
