Imports¶
Imports add data to Elevate 3 Enterprise and is done by posting XML with an Elevate 3 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, basic HTTP authentication with Elevate cluster credentials is required. Only one data type is allowed per import.
Method¶
POST
URL format¶
/api/v1/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 |
Import types¶
The following content types are allowed for the type
parameter.
products
(for products and categories)ads
synonyms
configuration
Read more about the import types and their file formats in the guide to working with imports.
Compression¶
It is recommended that the import is compressed with gzip
and the headers Content-Encoding
is set to gzip
.
Request body¶
An XML document containing the data to be imported, see Examples.
Compression
It's recommended that the import is compressed with gzip
and the headers Content-Encoding
is set to gzip
.
Request content-type¶
application/xml
Response content-type¶
N/A
Responses¶
Response | Description |
---|---|
204 | The import completed successfully. |
403 | Incorrect cluster credentials. |
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, that the cluster had not been defined prior the import, or that the import was rejected for being dangerous. The response body may contain more information about the error. |
503 | The server in the cluster that received the request is currently unavailable. It is recommended to retry the request. The time between request attempts should be increasing. |
5xx | Server error such as cluster unavailable or busy. The response body may contain more information about the error. |
Example¶
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" \
-u eSalesCustomerLogin:aLongPassword! "https://{cluster-id}.api.esales.apptus.cloud/api/v1/import/products?name=products-full-import-w-variants"
Response¶
HTTP/1.1 204 No Content