Create import

Definition

The API enables vendors, plugins, and enterprise clients to manage Imports externally by API. It adds the option to automate data flow by service instead of a manual user process. Utilizing the API can significantly shorten the time to import, which is useful for external plugins.

You may make use of Management API for Imports by:

  • Copying import definitions from one project to another.
  • Deploying the same import to multiple projects by a script.

Management API for Imports exposes API methods to list, read, create, and delete import definitions. Create operation creates a new import definition and supports:

  • Import from URL and File storage identified by integration_id.
  • Function 'run once' or 'run on a schedule'.
  • Running import every 30 minutes as the scheduler allows up to 48 scheduled daily repeats.
  • Creating up to 25 active import definitions in a project.
  • Importing Customers, Events, and Catalogs.

📘

Note

Imports created via the API can only be edited using the same API and not via the UI.

Authorization

In this API call you must use the following authorization access and permissions:

Available access typePermissions needed
Private accessImports > Allow to Create new Imports

Admin must first create Private access keys and grant permissions. Then the service can call the API and perform the operation.

Read more about:

Request

Path parameters

ParameterTypeDescriptionRequired
projectTokenstringThe ID of your project.Required

Body parameters

ParameterTypeDescriptionRequired
import_idstringThe ID of your import. Part of the success response.Optional
import_definitionobjectThe definition of your import.Optional

Import_definition object description

ParameterTypeDescriptionRequired
namestringThe name of your import.Required
triggerone of: objectThe trigger for import either now, or repeated based on frequency or new files.Required
activebooleanDefault: trueOptional
sourceone of: objectThe source of imported data.Required
destinationone of: objectThe destination where data is imported.Required
mappingobjectData mapping pattern of your import.Required

Trigger object description

Trigger can be defined by one of the two object descriptions:

(1) First trigger object description option:

ParameterTypeDescriptionRequired
trigger_typestringType of the trigger.

Allowed values: now, on_new_file
Required

(2) Second trigger object description option:

ParameterTypeDescriptionRequired
trigger_typestringType of the trigger.Required
frequencystringThe frequency in which imports are triggered.

Allowed values: hourly, daily, weekly, monthly
Required
timesarray[object]<= 48 itemsRequired
daysarray (oneOf) [Day_of_week] or
array (oneOf) [Day_of_month]
The days on which imports are triggered.Optional
minutesarray[integer]Required
timezonestringTimezone in which time of trigger is set.Required
from_datenumberFrom which date imports are triggered.Optional
to_datenumberTo which date imports are triggered.Optional

Times object description

ParameterTypeDescriptionRequired
hourinteger>= 0, <= 23Required
minuteinteger>= 0, <= 59Required

Source object description

Source can be defined by one of the two object descriptions:

(1) First source object description option:

ParameterTypeDescriptionRequired
source_typestringAllowed value: urlRequired
import_urlstringRequired
use_socks_proxybooleanDefault: falseOptional
authobjectOptional

(2) Second source object description option:

ParameterTypeDescriptionRequired
source_typestringAllowed value: filestorageRequired
integration_idstringThe ID of your integration.

>= 24 characters
Required
parent_pathstringOptional
pathstring>= 1 charactersRequired
file_selectionstringAllowed values: all, last_mod, last_alpha, not_importedRequired

Auth object description

Auth object description is only applicable in case of URL import.

ParameterTypeDescriptionRequired
usernamestringRequired
passwordstringRequired

Destination object description

Destination can be defined by one of the three object descriptions:

(1) First destination object description option:

ParameterTypeDescriptionRequired
event_destinationobjectA specific event type into which you import data.Required

(2) Second destination object description option:

ParameterTypeDescriptionRequired
customer_destinationobjectThe customer table where you import data.Required

(3) Third destination object parameter option:

ParameterTypeDescriptionRequired
catalog_destinationobjectThe catalog into which you import data.Required

Event_destination object description

ParameterTypeDescriptionRequired
event_typestring>= 1 charactersOptional
event_triggersbooleanDefault: falseOptional

Catalog_destination object description

ParameterTypeDescriptionRequired
catalog_namestringName of the catalog into which you import data.Required
catalog_attributesone of: objectOptional

Catalog_attributes object description

Catalog_attributes can be defined by one of the two object descriptions:

(1) First catalog_attributes object description option:

ParameterTypeDescriptionRequired
catalog_typestringAllowed values: generic, product, variantsRequired

(2) Second catalog_attributes object description option:

ParameterTypeDescriptionRequired
catalog_typestringAllowed values: generic, product, variantsRequired
associated_product_catalog_idstringThe ID of your product catalog.Optional

Mapping object description

ParameterTypeDescriptionRequired
tz_infostringThe timezone to use for time/datetime/timestamp columns.

Default: UTC
Optional
column_mappingobjectRequired

Column_mapping object description

ParameterTypeDescriptionRequired
id_mappingsarray[object]The ID of your mappings.Required
property_mappingsarray[object]Required
timestamp_columnstringOptional

Id_mappings object description

ParameterTypeDescriptionRequired
from_columnstringRequired
to_idstringRequired

Property_mappings object description

ParameterTypeDescriptionRequired
from_columnstringOptional
to_columnstringRequired
target_typestringDefault: stringOptional
searchablebooleanOptional
indexedstringIndicates whether a property should be indexed for faster retrieval.Optional

Response description

ParameterTypeDescriptionRequired
import_idintegerThe ID of your import.Optional

❗️

Limitations

  • Update API method is not implemented.
  • You cannot create an import for Vouchers.
  • You cannot create import of other types (e.g. from Input/Uploaded file, from Database by query, from the application).
  • Managing import definitions created by Users is done in the app (not via API).

API rate limits:

  • The joint number of requests for operations 'List', 'Read', and 'Delete' cannot exceed 100 requests per minute.
  • Up to 10 requests for the 'Create' operation are allowed per minute, with a maximum of 48 allowed requests per day. The limit for active import definitions is 25.
Language
Credentials
Basic
base64
:
Click Try It! to start a request and see the response here!