API 8 - Importing Data

API

The Sales Layer API allows you to update stored fields using the POST parameters.

In order to import / enter data via API requests, it is necessary to configure a generic import connector on the cloud side of the Sales Layer PIM.

From the connector you can configure access to the fields you wish to modify and protect the rest for security.

Data Structure

“input_data” = [
    “{table name}” *** = [
        [
            ”ID” = “{Unique register ID in Sales Layer}” or…
            “REF” = “{Unique register reference}”
            “{field name}” = “{new field value}”,
            “{field name}” = “{new field value}”,
            ...
        ],
        [ … ]
    ],
    “{other table name}” = [
        ...
    ]
]

The list of items can be a URL linked to a CSV file.

CSV File example

{“input_data”:{
    “products”:”http://externaldomain.com/download/product_items.csv”,
    …

Other parameters:

get_output_data” = 0/1 (default: 0)

If we enter new data, updated information will not be returned unless explicitly desired.

get_affected_ids” = 0/1 (default: 0)

In the response, return the id → reference pairs of each affected item in: 'new_items', 'updated_items' and 'deleted_items'.

Import Option

The field names will be those defined in the connector in the “Name on Import” section, not to be confused with the final name of the field in Sales Layer Cloud (Related Field).

If an #Alias ​​of a Table is defined, then this must be respected when defining the data to be imported in a request or HTTP call using POST.

To allow the creation of new records (Categories, Products, Variants, ...) you must make sure that the connector has the parameter “Only Update Existing Items” marked as "NO" in each table. If you only want to update existing data on the Cloud side of the PIM, keep this parameter as “YES”.

It is possible to define filtering or data manipulation formulas in the connector that will modify the values ​​to be imported before updating them on the Cloud side of the PIM.