KPK files

The Konect CLI can import and export the propriety Konect format KPK file (Konect PacKage file). KPK files contain the configuration about 1 or more datasets or projects, and optionally all the data and attachments found in the datasets or projects.

KPK file configuration objects

KPK files can be used to backup and restore configuration or to move configuration between environments or organisations. All configuration objects exported to a KPK file retain the same internal ids, so when they are imported they will overwrite any existing objects of the same id. This allows for backup and restore of configuration. Since the Konect CLI doesn’t have an option to verify what objects will be overwritten care needs to be taken, as the import can not be rolled back. The following are the configuration objects that are exported to KPK files for each export type.

Datasets in KPK files

When a dataset is exported to a KPK file the following configuration objects are included

  • Dataset definition

  • All lists in any list fields

  • All queries on the dataset

Projects in KPK files

When a project is exported to a KPK file the following configuration objects are included

  • Project definition

  • Dataset definitions for all datasets in the project

  • All lists in any list fields for all datasets

  • Just the queries that are involved in project

KPK file data and attachments

KPK files can optionally contain dataset records, attachments and overlays. Just like configuration objects all records and attachments in a KPK file contain the same internal ids, so when the KPK is imported the data and attachment can overwrite existing records.

Data that is moved between environments and organisations via a KPK file, will follow the same conflict resolution rules that the Konect app uses when a project is taken offline. The record with the most recent modified date will be used as the current record. If the imported record has an earlier modified date then the current record in the cloud a transaction record will be kept.

Attachment data has a slightly different conflict resolution, Konect will merge new and removed attachments from earlier transactions, while the most recent attachment overlay will be kept.

KPK files for projects will only export the data and attachments that is contained in project. This means only data in queries will be exported rather then the entire dataset (when the project only contains queries). Projects that contain multiple queries on the same dataset may take longer to export and import if their is a large intersection of records between the queries.

Konect CLI KPK file commands

The Konect CLI has the following KPK file commands

  • kpkexport

  • kpkimport

Konect CLI KPK file parameters and flags

The following are all the parameters and flags available to the Konect CLI KPK file commands.

Parameters and flags

Example value

Required

Definition

Parameters and flags

Example value

Required

Definition

-k, --key

XXXXXXXXXXXXX

Yes

A valid API key for the organisation with permissions on the specified environment

-e, --env

"Environment name"

Yes

The environment to export data from

-f, --file

C:\export\file.kpk

Yes

The kpk fie to import or export to

-d, --datasets

dataset1 dataset2

No

Specify which datasets to export. Dataset names are separated by spaces.

This parameter is only used for KPK exports, and can’t be used with the --projects parameter.

-p, --projects

project1 project2

No

Specify which projects to export. Project names are separated by spaces.

This parameter is only used for KPK exports, and can’t be used with the --datasets parameter.

-i, --includedata

 

No

If this flag is on, export all data and attachments to the KPK file.

This parameter is only used for KPK exports.

--excludelogfile

 

No

If this flag is on do not write a log file.

--logfilename

log.ext

No

The name of the log file. By default the log file is written to the same folder as the export. Use the --logfolder setting to change the folder where the log file is written.

--logfolder

C:\export\file.ext

No

The folder to write the log file. If --logfilename is not specified the default log file name is used which is based on the dataset name IMPORTLOG_[dataset name].ext.

--proxyhost

hostname

No

The proxy host for any proxy settings

--proxyport

8080

No

The proxy port for any proxy settings

--proxyusername

john

No

The proxy username for any proxy settings

--proxypassword

johnspassword

No

The proxy password for any proxy settings