Web API: Importfile: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:
Following parameters can be defined:
Following parameters can be defined:
* '''fileType''' (string): Defines content format of the imported file. Options are '''csv''', '''pacm''' and '''xes'''.
* '''fileType''' (string): Defines content format of the imported file. Options are '''csv''', '''pacm''' and '''xes'''.
* '''importMode''' (string): Defines what kind of data is imported. Options are '''datatable''', '''events''' and '''cases'''. Needed when fileType=csv.
* '''objectId''' (integer): Datatable id. Needed when importing data to an existing datatable.
* '''objectId''' (integer): Datatable id. Needed when importing data to an existing datatable.
* '''append''' (boolean): When true, the possible previous data in the destination datatable is preserved. When false, previous data is removed and also datatable columns are deleted.
* '''append''' (boolean): When true, the possible previous data in the destination datatable is preserved. When false, previous data is removed and also datatable columns are deleted.
Line 21: Line 20:
* '''csvStartImportFromLine''' (integer): The column name row in the csv file.
* '''csvStartImportFromLine''' (integer): The column name row in the csv file.
* '''isCompressed''' (boolean): When true, the file is compressed using gzip format. Only csv and xes files can be provided as compressed (pacm file is already a gzip file).
* '''isCompressed''' (boolean): When true, the file is compressed using gzip format. Only csv and xes files can be provided as compressed (pacm file is already a gzip file).
When importing to an existing datatable, data needs to be compatible with the column datatypes. Following conversions are made:
* String: No conversion needed.
* Integer: try convert to integer.
* Float: try convert to float using "." as decimal separator.
* DateTime: try convert to date using the provided ''csvTimeFormat''.
* Boolean: try convert to boolean with ''true'' as true value and ''false'' as false value.
* Duration: try convert to integer and interpret the value as ticks (10000 ticks is 1 millisecond).
* Import empty cell as ''null'' value.


[[Category: QPR ProcessAnalyzer]]
[[Category: QPR ProcessAnalyzer]]

Revision as of 19:47, 8 June 2021

The importfile operation imports data from a text file to a datatable.

Only UTF-8 character encoding is supported (file needs to be converted into UTF-8 to be able to import it successfully). In case some other character encoding is used, it might lead to invalid characters, which are still imported. In case invalid characters are imported, either a new import needs to be made with a corrected file, or the data needs to be cleaned using a script.

HTTP request header Authorization with value Bearer <access token> needs to be in place to identify the session.

Url: POST /api/importfile?param1=value1&param2=value2&param3=value3
Content-Type: multipart/form-data
Body: <file contents>

Following parameters can be defined:

  • fileType (string): Defines content format of the imported file. Options are csv, pacm and xes.
  • objectId (integer): Datatable id. Needed when importing data to an existing datatable.
  • append (boolean): When true, the possible previous data in the destination datatable is preserved. When false, previous data is removed and also datatable columns are deleted.
  • csvDelimiter (string): Column delimiter character for the csv format.
  • csvTimeFormat (string): Date format to use when interpreting date values for the csv format.
  • csvQualifier (string): Character used to enclose strings for the csv format.
  • csvStartImportFromLine (integer): The column name row in the csv file.
  • isCompressed (boolean): When true, the file is compressed using gzip format. Only csv and xes files can be provided as compressed (pacm file is already a gzip file).

When importing to an existing datatable, data needs to be compatible with the column datatypes. Following conversions are made:

  • String: No conversion needed.
  • Integer: try convert to integer.
  • Float: try convert to float using "." as decimal separator.
  • DateTime: try convert to date using the provided csvTimeFormat.
  • Boolean: try convert to boolean with true as true value and false as false value.
  • Duration: try convert to integer and interpret the value as ticks (10000 ticks is 1 millisecond).
  • Import empty cell as null value.