How to Upload a File Via REST API Calls

Goal

Create a file upload and upload a file via REST API calls.  

Learn

Step-by-step guide

To upload a file it will be necessary to give some configuration with, you usually would do this via web UI. These settings are e.g. file type and file name. So proceed according How to create a connection via REST API calls to gather a sample payload. 

{
  "version": "5.9.1",
  "className": "datameer.dap.common.entity.DataSourceConfigurationImpl",
  "file": {
    "uuid": "00000000-0000-0000-0000-000000000000",
    "path": "/Data/ImportJobs/FileUpload.upl",
    "description": "",
    "name": "FileUpload"
  },
  "pullType": "MANUALLY",
  "minKeepCount": 1,
  "properties": {
    "GenericConfigurationImpl.temp-file-store": [
      "489ce158-3fc2-40f7-a061-f5dfd7dab316"
    ],
    "fileType": [
      "CSV"
    ],
    "delimiter": [
      ","
    ],
    "detectColumnDefinition": [
      "SELECT_PARSE_AUTO"
    ],
    "data.includes.header": [
      "true"
    ],
    "ignore.first.n.lines": [
      "0"
    ],
    "characterEncoding": [
      "UTF-8"
    ],
    "recordSampleSize": [
      "1000"
    ],
    "escapeCharacter": [
      ""
    ],
    "quoteCharacter": [
      "\""
    ],
    "strictQuotes": [
      "false"
    ],
    "csv.max-lines-per-record": [
      "1"
    ],
    "collectAdditionalFields": [
      "false"
    ],
    "ObfuscatedColumns": [
      ""
    ],
    "filter.page.does.split.creation": [
      "false"
    ],
    "TextFileFormat": [
      "TEXT"
    ],
    "file": [
      "/<path-to-file>/<data-to-upload>.csv"
    ]
  ...

Proceed according How to create a connection via REST API calls to edit the sample payload to your needs. 

The "GenericConfigurationImpl.temp-file-store": [<uuid>] is not required. If it doesn't exist, Datameer will create one on the fly as well. So it is recommended to remove these three lines from the payload.

"GenericConfigurationImpl.temp-file-store": [
"<uuid>"
],

After you have created your file upload the artifact will be available in Datameer but not executed instantly. To execution the upload job it is necessary to trigger the job via an other call REST API Import Job, DataLink and File Upload - Start Import/Link/Upload.