Amazon Feed Transformer
  • Installation
  • Getting started
  • Feed Types
    • XML feeds
      • Inventory Availability
      • Product Pricing
      • Product Images
      • Product Relationships
      • Products
    • Flat file feeds
      • Inventory Loader
      • Price and Quantity Update
      • Flat File Listings
      • Convergence Listings
      • Flat File Bookloader
      • UIEE Bookloader
  • Validation
Powered by GitBook
On this page
  • Usage
  • Parameters
  • merchantId
  • shippingGroupMap
  • onUnsupportedField
  • callback
  1. Feed Types
  2. Flat file feeds

Flat File Listings

PreviousPrice and Quantity UpdateNextConvergence Listings

Last updated 17 days ago

Usage

To convert a POST_FLAT_FILE_LISTINGS_DATA feed to the newer JSON_LISTINGS_FEED format:

use SellingPartnerApi\FeedTransformer\Transformer;
use SellingPartnerApi\FeedTransformer\FeedTypes\Listings;

$feedFile = 'path/to/your/feed.tab';
$json = Transformer::fromFile(
    Listings::$feedType,
    $feedFile,
    'ATVPDKIKX0DER'
);

$jsonFeedPath = 'path/to/new/feed.json';
file_put_contents($jsonFeedPath, json_encode($json));

The first time using this feed transformer with a particular product type, we strongly recommend running the converted data through before putting it into production. That way, you can ensure you know if certain elements of your feed aren't able to be mapped to the new format.

Parameters

merchantId

Required

shippingGroupMap

Required if the merchant_shipping_group_name column is present in the feed file being converted.

onUnsupportedField

Optional. Default fail.

This option controls what happens when the feed transformer encounters an XML tag that has no direct equivalent in the new JSON format. There are two accepted values:

  • ignore: Silently move past un-mappable XML tags.

  • fail: The first time an un-mappable XML tag is encountered, throw an InvalidFeedException. This is the default.

callback

Conditionally required if onSupportedField is set to callback .

This option is the callback to be called if onSupportedField is set to callback and an un-mappable XML field is encountered while processing the input data. The callback's signature is fn (string): void. For example:

$options = [
    'onUnsupportedField' => 'callback',
    'callback' => function ($field) {
        echo "Unsupported field: $field";
        // -> Unsupported field: unsupported_field_name
    },
    // ...
];

There is documentation on how to retrieve your merchantId in the section of the Flat file feeds page.

This is a mapping of your account's shipping group names to their internal Amazon identifiers. Instructions on how to generate this mapping are here:

callback: Pass un-mappable XML fields (by ) to a user-defined callback. See

our validators
shippingGroupMap
xpath
callback
Common required parameters