Skip to content

Validate the stock update

To validate a stock/price update CSV file, the following endpoint is used:

https://merchants-connector-importer.zalandoapis.com/{ClientID}/validate/

4.5MB size limit for testing

This endpoint should be used ONLY for manual testing purposes and the size of the stock file MUST NOT exceed 4.5 MB.

Option 1: Using a CLI or a Program

HTTP Request

  • PUT method

URL Parameters and Header

Parameter Type Example
Client ID String d329krpq
Stock File Name CSV 20181023_update.csv
API Key (x-api-key) String lXViWTzFic9sM8Qqe9Ew7JME8xTdBAOMJHdIjK7XkjQ00OWr

Code Samples

Shell

curl -v -X PUT -H "x-api-key: lXViWTzFic9sM8Qqe9Ew7JME8xTdBAOMJHdIjK7XkjQ00OWr" 
-H "Content-Type: text/csv" 
--upload-file 20181023_update.csv 
https://merchants-connector-importer.zalandoapis.com/d329krpq/validate | jq '.'

Powershell

Invoke-WebRequest `
-UseBasicParsing `
-Uri https://merchants-connector-importer.zalandoapis.com/d329krpq/validate `
-Method PUT -InFile 20181023_update.csv `
-Headers @{'x-api-key'='lXViWTzFic9sM8Qqe9Ew7JME8xTdBAOMJHdIjK7XkjQ00OWr'; 'content-type'='text/csv'}

Python

import requests

client_id = "d329krpq"

headers = {
    'x-api-key': "lXViWTzFic9sM8Qqe9Ew7JME8xTdBAOMJHdIjK7XkjQ00OWr",
    'content-type': "application/csv",
    'cache-control': "no-cache"
}

with open('feed_data_to_validate.csv', 'rb') as f:
    res = requests.put(f"https://merchants-connector-importer.zalandoapis.com/{client_id}/validate".format(client_id=client_id), headers=headers, data=f.read())

    print(res.json())

Response

The result returns a status 200 with a JSON body containing :

  • errors : array of the failures (FCI will reject the whole file or discard the errored lines)
  • warnings : array of the warnings (FCI might discard the warned lines)
  • result : message containing a summary of the validation
[
  {
  "errors": [
    {
      "details": [
        "EAN length must be 12 or 13",
        "EAN checksum invalid"
      ],
      "message": "column name : [ean]",
      "type": "Invalid column value",
      "line_numbers": [
        347,
        350,
        351,
        353,
        4436,
        4437,
        4438,
        4439,
        4440
      ]
    }
  ],
  "result": "FAILED! Fashion Connector will not be able to process the file. Please correct the errors.",
  "warnings": []
 }
]

Option 2: Using Postman GUI

Step 1: Download a Chrome browser

Chrome Web browser

If you use any other web browser then please download Chrome browser as the Postman extension requires a Chrome browser.

Step 2: Install Postman Chrome extension

Postman Extension

You can install Postman from here. You can also download Postman app on your Windows or Mac machine. Please launch the Postman extension and create an account in Postman.

Step 3: Close all pop-ups in postman until you see the screen below:

Postman

Postman Intro

Step 4: Select “PUT” under the drop down

PUT

Postman PUT

Step 5: Copy the URL to the text box in Postman

`https://merchants-connector-importer.zalandoapis.com/{ClientID}/validate`

Client ID

The Client ID is obtained from your Key Account Manager. We will use d329krpq as an example. Please use your own Client ID.

URL

Postman Client ID

Step 6: Select Headers tab

x-api-key

Add a key called x-api-key and enter your secret API Key obtained from your Key Account Manager as value.

x-api-key

Postman X API Key

Step 7: Add another key as Content-Type

The value should be text/csv as the format of the stock update file is CSV.

Content-Type

Postman Content Type

Step 8: Select Body tab

Choose the binary radio button and click on Choose Files. Add your stock file in CSV format.

Add stock update file

Postman File

Step 9: Click Send button

You should be able to see some errors on the body of the response. An example is given below.

Response

Postman Result

Most Common Errors

Here are some of the most common errors and how to mitigate them.

Error 1: Unauthorized

Unauthorized

Postman Unauthorized

Reason

Wrong credentials

Please check if the Client ID and/or API Key are correct.

Error 2: Failed to parse the CSV file

Parsing failed

Postman CSV missing

Reason

No file or size is too big

Either no stock file was selected to upload OR the uploaded file size was bigger than the limit.

Error 3: Request exceeded

Request exceeded max char limit

Postman Size

Reason

Request exceeded max char limit

The stock file size might be bigger than 4.5MB or the stock file encoding is not UTF-8.

Error 4: Invalid column value

Invalid column value

Postman Invalid EAN

  • Type : What kind of error (in this example, the value is invalid)
  • Message : Details on the column (in this example ean column)
  • Line numbers : Which lines have this error (3378, 3379…)
  • Details : The reason of the error (in this example, the EAN is not valid)

Reason

EAN is not valid

This happens when the EAN value doesn’t match the constraints defined here

Check the EAN validity

You can check the validity of your EANs from here