Bridge to Data Import

The Web API has got an endpoint that works as a bridge to the data import framework of SmartStore.NET. It allows to upload import files into the import folder of an import profile. We call it bridge because an import folder is private and for security reasons not directly accessible through the internet. This bridge allows third party applications to frequently upload import files on a secure way, which can be automatically imported by the scheduled task that is associated with each import profile. Remember, an import profile is a plan that summarize   all  required  information  to   individually   control  an   import operation.

The import files must be multipart MIME formatted thus uploaded  by a single multipart form data POST request.

Example
POST http://localhost:1260/api/v1/Uploads/ImportFiles
Content-Type: multipart/form-data; boundary=----------baf963f4824948e28b3f66c04cebb14b

------------baf963f4824948e28b3f66c04cebb14b
Content-Disposition: form-data; name="Id"

12
------------baf963f4824948e28b3f66c04cebb14b
Content-Disposition: form-data; name="my-file-1"; filename="1-12-0001-productcsvexport.csv"; CustomValue1="my custom value1"; CustomValue2="say hello to my-file-1"
Content-Type: application/octet-stream

<Binary file data here (length 54237 bytes)...>
------------baf963f4824948e28b3f66c04cebb14b--

First, you have to specify an import profile identifier to identify the profile for which the import files are intended. There are two types of identifiers:

  • Id: The SmartStore.NET internal, numeric import profile identifier.
  • Name: The name of the import profile.

Use one of these types and a proper value to identify the import profile. In the example,  Id  is used with a value of 12.  There is another option  deleteExisting available. If it is set to true then all existing files (including sub directories) are deleted. You can also upload ZIP files which is useful for very large import files. ZIP files are always unzipped into the import folder of the profile.

Existing import files are always overwritten.

The API response is similar to the response of the ProductImages endpoint:

Example
[
  {
    "IsSupportedByProfile": true,
    "Name": "my-file-1",
    "FileName": "1-12-0001-productcsvexport.csv",
    "FileExtension": ".csv",
    "MediaType": "application/octet-stream",
    "Exists": true,
    "Inserted": true,
    "ContentDisposition": [
      {
        "Name": "name",
        "Value": "\"my-file-1\""
      },
      {
        "Name": "filename",
        "Value": "\"1-12-0001-productcsvexport.csv\""
      },
      {
        "Name": "CustomValue1",
        "Value": "\"my custom value1\""
      },
      {
        "Name": "CustomValue2",
        "Value": "\"say hello to my-file-1\""
      }
    ]
  }
]
  • IsSupportedByProfile: Indicates whether the uploaded import file is not in conflict with the settings of the import profile (e.g. the file type must match).