Data Import: Files

Last edit: Jul 09, 2019
  • Contributors:
  • pavelloz

This topic describes importing files: images and attachments.

Models and Users can store images and attachments in properties. To import them you need to have the proper data model in *.yml files. Here is an example model with images and attachments:

name: car
properties:
- name: color
  type: string
- name: car_document
  type: file
- name: car_photo
  type: image

Uploading files with CLI

To import files with pos-cli, prepare a JSON file with paths to existing files. You need to have those files on your disk. Read more about the required structure in our reference docs. Here is an example JSON file that assumes you have files in the import_files/ directory:

{
  "models": [
    {
      "id": "id",
      "type_name": "car"
      "user_id": null,
      "properties": {
        "color": "red"
      },
      "attachments": [
        {
          "url": "import_files/offer.pdf",
          "name": "car_document"
        }
      ],
      "images": [
        {
        "url": "import_files/car.png",
        "name": "car_photo"
        }
      ]
    }
  ]
}

During the import, pos-cli will upload the files to our storage and match them with corresponding records.

Questions?

We are always happy to help with any questions you may have.