Skip to content
×
Copyright

This online publication is intellectual property of Apptus Technologies. Its contents can be duplicated in part or whole, provided that a copyright label is visibly located on each copy and the copy is used in conjunction with the product described within this document.

All information found in these documents has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither Apptus Technologies nor the authors shall be held liable for possible errors or the consequences thereof.

Software and hardware descriptions cited in these documents might be registered trademarks. All trade names are subject to copyright restrictions and may be registered trademarks. Apptus Technologies essentially adheres to the manufacturer’s spelling. Names of products and trademarks appearing in this document, with or without specific notation, are likewise subject to trademark and trade protection laws and may thus fall under copyright restrictions.

CLOSE

Imports

Imports add data to eSales and is done by posting XML with an eSales Enterprise data type to the Web API. The XML must be encoded using UTF-8 and include the operations that is to be performed and all other data type related information. Allowed operations for imports are add, update, remove, and clear.

When importing data via the Web API, an Api-Key header is required for authentication. Only one data type is allowed per import.

Method

POST

URL format

/api/v2/import/{type}?name={name}

Parameters

Name Type Description Example
type string Type of import. Only one data type is allowed per import. See Import types
name string Optional name of the import. products-2017-09-06
import XML The request body in XML. See Examples
blockingTimeout string Max duration to wait for a response, ISO-8601 formatted duration with a maximum of 5 min. PT1M

Import types

The following content types are allowed for the type parameter.

  • products (for products and categories)
  • panels
  • ads
  • synonyms
  • configuration

Read more about the import types and their file formats in the guide to working with imports.

Long running imports

If an import exceeds the maximum duration, a 202 ACCEPTED response will be returned containing information regarding the import. This information contains an id, which can be used to continously poll the status of the import via /api/v2/import/status/{id}.

Name Type Description Example
id string The id of import. 5537431447739019570
status string The progression status of the import. IN_PROGRESS
type string The entity type that is being handled in the import. PRODUCTS
reason string Potential error message of a failed import. Import failed.

Compression

It is recommended that the import is compressed with gzip and the headers Content-Encoding is set to gzip.

Required headers

The header Api-Key is required.

Request body

An XML document containing the data to be imported, see Examples.

Request content-type

application/xml

Response content-type

HTTP response code

Responses

Response Description
202 The import has been accepted and will continue to be handled. An id will be returned.
204 The import completed successfully.
403 Incorrect Api-Key.
404 Cluster not found.
409 An import of the same type is currently in progress.
4xx The request made by the client was invalid. This may mean that the import contained errors or that the cluster has not been defined prior the import. The response body may contain more information about the error.
5xx Server error such as cluster unavailable or busy. The response body may contain more information about the error.

Examples

Try out the API at the Apptus API Playground with your eSales Playground and API credentials.

Request

products-full-import-w-variants.xml

<?xml version="1.0" encoding="UTF-8"?>
<operations>
    <clear>
        <category_tree />
        <product />
    </clear>
    <add>
        <product>
            <product_key>P001</product_key>
            <market>UK</market>
            <locale>en-GB</locale>
            <title>The Magical Programmer</title>
            <category>Movies</category>
            <variants>
                <variant>
                    <variant_key>V001</variant_key>
                    <format>DVD</format>
                    <price>£11.99</price>
                </variant>
                <variant>
                    <variant_key>V002</variant_key>
                    <format>Blueray</format>
                    <price>£13.99</price>
                </variant>
            </variants>
        </product>
    </add>
</operations>

cURL

#!/bin/bash
curl -i \
-X POST \
-T products-full-import-w-variants.xml \
-H "Content-Type: application/xml" \
-H "Content-Encoding: gzip" \
-H "Api-Key: {PRIVATE-KEY}" \
"https://{cluster-id}.api.esales.apptus.cloud/api/v2/import/products?name=full-prod-import-w-variants"

Response

HTTP/1.1 204 No Content

Last update: June 4, 2020