Import / Export API
Please note that the Import / Export API is deprecated and will be removed in the 2023-R2 release.
You should instead use the Perfion API or the Perfion Application Server, e.g via an scheduled Action, for running imports and exports.
All imports and exports in Perfion can be performed via application programming interface (API), e.g. from a custom project by utilizing Perfion libraries and importer/exporter interfaces.
This page describes import/export procedures which can be performed in Perfion version 2020 R2 or newer. Before Perfion version 2020 R1 the access to imports was limited and importers had less features as compared to the new interfaces. Form Perfion version 2020 R2 the export interface was implemented.
Perfion version | Import | Export |
Before 2020 R1 | Feature data import | - |
2020 R1 (v4.7) | All imports | - |
2020 R2 (v4.8) or newer | All imports | All exports |
The previously used import procedures are still usable, but have been deprecated. It is recommended to use only the new procedures from Perfion version 2020 R1.
Import
Import via API uses a generic Perfion Importer interface which can be used to perform all types of imports supported by Perfion.
Perfion Importer Interface
All imports in Perfion implement IPerfionImporter interface. The interface is generic and allows doing the following:
Load the import data from different sources
Get loaded import data
Set import parameters
Get import parameters
Start import
Stop import
Get import status
Get import name and type
Subscribe to Log and Status events
Import Initialization
There are two types of importers:
Generic importer. It is based on IPerfionImporter interface and all importers are based on this interface.
Specific importer for chosen import type. There is one specific importer for each type of import. Specific importers are based on generic importer and the only difference is that specific importer allows strong typed parameters.
Get Feature Data importer |
|
Loading Import Data
The import data can be loaded from different sources. Perfion supports loading data from:
File. There are several type of files supported by Perfion:
Microsoft Excel 97/2003 or newer (.xlsx, .xls).
XML (.xml).
CSV (.csv).
XLIFF (.xliff, .xlf) – Only Feature Data import supports this file type.
DataTable. The import data can be loaded using C# .NET DataTable. This allows importing data from any other data sources by implementing a custom interface for that specific data source and then loading data as DataTable. The data must be set up based on requirements for each import type.
For more information about supported file formats refer to “Perfion Import & Export – Data & File Formats” and “Perfion Import / Export Translations XLIFF” manuals.
For more information about data setup requirements for different type of imports refer to the manuals for actual imports.
Import Parameters
There are different ways to load import parameters.
Using key-value concept where all parameters are loaded using parameter name and value. All importers support this method. To set parameters using this method one can use only those parameters which have to get a new value. The process is loosely coupled so that all parameters passed to the importer which are not related to that importer will be ignored and those parameters which are known will be updated with new values. Most of import parameters have default values, so one has to set only those parameters which are mandatory.
Using importer’s properties. This can be done only by using the specific importers. For example, the feature data importer will allow setting only those properties, which are related to feature data import. As it was a case with key-value concept, mandatory parameters must be specified, while all other parameters will have default values if not set explicitly.
Set Feature Data importer parameters |
|
Parameters for different types of imports:
Parameter name | Mandatory | Description and values |
Feature Data import parameters | ||
ImportToFeature | Yes | Feature to import data to. Can be feature ID or feature name. |
KeepFirstDuplicate | No | By default Perfion will ignore import items with duplicate keys. This parameter allows to keep the first duplicate item. Values:
|
ImportOption | No | Specifies how the import will treat data cells with empty values in case the item already has a value defined in Perfion. Values:
|
SelectableFeatureValidation | No | By default Perfion imports all selectable values and automatically creates all the selectable lookup values in the process. This behavior can be changed by setting this parameter. Values:
|
IncomingDataCulture | No | Specifies the culture which will be used to parse Number and Date type feature values if they are loaded to the importer in string/text format. If parameter is not specified, then the default culture will be used which is set up in the PC which runs the import. If parameter is specified with empty value, then the import will use invariant culture. Perfion supports all culture values supported by .NET CultureInfo. Example of culture values: da-DK, en-US, etc. |
Feature Definition import parameters | ||
Feature Definition import has no parameters | ||
Feature Configuration import parameters | ||
ImportToConfigID | No | Configuration ID to which the feature configuration data should be imported to. Default value is 0. |
Related Sort Order import parameters | ||
CategorizerFeatureID | No | Import scope filter parameter which allows limiting import scope to selected categorizer feature ID. Default value is 0. |
CategorizerFeatureItemID | No | Import scope filter parameter which allows limiting import scope to selected categorizer feature item ID. Default value is 0. |
RelatedFeatureID | No | Import scope filter parameter which allows limiting import scope to selected related feature ID. Default value is 0. |
Action import parameters | ||
ExistingActionHandling | No | Existing action handling. Values:
|
NOTE: All parameter names and values are case insensitive.
For more information about import parameters refer to the manuals for actual imports.
Start Import
Before one can start the import the import data has to be loaded and import parameters must be set to correct values.
Start Feature Data import |
All imports in Perfion are controlled globally and typically only a single import can run at a time. All this control is done by the import/export manager. When the import is started it is assigned a queue number and is put in a waiting list. If there are no other imports running or waiting, then the import will start immediately.
To learn more about import/export manager refer to “Import/Export Manager” manual.
Import Status
Importers can report their status either by asking importer directly or one can also subscribe to status change event.
There are following import statuses:
NA. The import was not started.
Waiting. The import was initiated, but it is waiting for its turn to run. The data from all imports is logged in Perfion database and it can take some time before all preparation procedures are completed and the actual import process can start. There could also be other imports with higher priority running or waiting in a queue, so the import will stay in this state until other imports are completed.
Running. The import process have started. In this state importer starts data validation process and various other procedures.
Importing. It depends on import type what is actually happening when importer is in this state, but in general it means that data validation have been completed and that importer is performing the actual data import to Perfion database.
Stopped. The import have been stopped by a user.
Failed. The import have been stopped because of some failure. The cause of the failure should be available in the import log.
Succeeded. The import have successfully completed.
Get importer status |
Stop Import
The imports are designed to be stopped at any time. The stopping, however, may not happen immediately, because the “soft” stop is used. This means, that the import will stop as soon as it have finished the operation it currently performs. Based on what the importer is currently doing, it can take some time. For example, if the import is running some procedure for data insertion to the database, then after issuing the stop command the import will stop only after that procedure is completed.
Stopping of the import affects not just the actual import, but also the import/export manager. Import/export manager is designed to remove any waiting imports from the queue when the stop command is issued. The import/export manager have some predefined status check inte