Get the Result of a Catalog Upload

📘

Buy with Prime API is now available for early access

Sign up for early access to the Buy with Prime API using the 'Sign Up' button below. The API may change as Amazon receives feedback and iterates on it.

After you use the Buy with Prime Catalog interface to upload your catalog and start feed processing, you can retrieve the feed file processing results in the following two ways:

This topic shows both methods.

For an overview of catalog terminology, see Catalog Interface. To learn how to call the Buy with Prime API, see Call the Buy with Prime API.


Sample data

The examples in this topic use the following sample data.

Sample catalog data
let inSearchOfLostTime = {
    title: "In Search of Lost Time",
    isbn: "12345",
    offerPrime: true,
    sku: "12345",
    amazonSku: "12345",
    imageUrl: "https://example.com/image-12345.jpg",
    detailPageUrl: "https://www.amazon.com/dp/12345"
};
let prideAndPrejudice = {
    title: "Pride and Prejudice",
    isbn: "678910",
    offerPrime: true,
    sku: "678910",
    amazonSku: "678910",
    imageUrl: "https://example.com/image-678910.jpg",
    detailPageUrl: "https://www.amazon.com/dp/678910"
};

Get the file ID of a catalog feed result

Before you can get a link to download the catalog feed result, you must perform a catalogFeed query to get the associated file ID. In the query, use the id from the CreateCatalogFeedResponse you received when you started feed processing.

The response contains a fileId that you use to get a link to the catalog feed result.

The following example shows how to get the fileId of a catalog feed result.

Request
// GraphQL query to get the catalog feed result
query CatalogFeed($catalogFeedId: ID) {
    catalogFeed(catalogFeedId: $catalogFeedId) {
      result {
        resultReport {
          ... on UploadedFile {
            fileId
          }
        }
      }
    }
  }
}

// Query variables
{
  catalogFeedId: createCatalogFeedResponseJson.data.createCatalogFeed.id
}
Response
{
  "data": {
    "catalogFeed": {
      "id": "example-catalog-feed-id",
      "status": "COMPLETED",
      "result": {
        "resultReport": {
          "fileId": "example-file-id"
        }
      }
    }
  }
}

Get a link to a catalog feed result

To get a link to a catalog feed result, perform a downloadLink query with the fileId that you received when you performed a catalogFeed query in the previous step.

Request
// GraphQL query to get a download link
query DownloadLink($fileId: String) {
    downloadLink(fileId: $fileId) {
      downloadUrl
    }
  }
}

// Query variables
{
  fileId: catalogFeedReportResponseJson.data.result.resultReport.fileId
}
Response
{
  "data": {
    "downloadLink": {
      "downloadUrl": "https://example.com/download-url"
    }
  }
}

Download a catalog feed result file

After you get a link to the catalog feed result, you can download the CSV file by using a standard interface in your chosen programming language. For a description of the fields in the catalog feed result file, see Catalog feed processing result file.

The following example shows how to use the download link to create a stream of the catalog feed result file.

Request
// Using the download link, create a stream of the catalog feed report file
const stream = fs.createWriteStream('./book_library_processing_signals.csv');
const { body } = await fetch(catalogFeedReportDownloadLinkResponseJson.data.downloadUrl);
await finished(Readable.fromWeb(body).pipe(stream));
Downloaded CSV file

The following example file shows the COMPLETED, SKIPPED, and FAILED statuses that the Catalog feed operation might return.

Import Result,Error Type, Error Code(s),Error Detail(s),External ID,Updated External ID,SKU,Amazon SKU,Offer Prime,Image URL,Product Detail Page URL
SUCCEEDED,,,,externalId,,sku,amazonSku,true,https://example.com/image.jpg,https://example.com/product
SKIPPED,,,,externalId,updatedExternalId,sku,amazonSku,true,https://example.com/image.jpg,https://example.com/product
FAILED,ValidationError,MissingRequiredProductDetailPageUrl,Product detail page URL is required when Is Prime Intended is true.,externalId,updatedExternalId,sku,amazonSku,true,https://example.com/image.xyz,https://example.com/product

Get catalog feed signals

You can get a list of global signals that pertain to a catalog feed. If you choose to do so, you should still download a catalog feed result file.

The following example shows how to get a list of signals related to a catalog feed. For a description of the fields, see Signal.

Request
// GraphQL query
query catalogFeed($catalogFeedId: String!) {
      catalogFeed(catalogFeedId: $catalogFeedId) {
          id
          status
          result {
             signals {
                code
                signalMessage {
                   locale
                   message
                }
                impactSummary {
                   locale
                   message
                }
                reactionSummary {
                   locale
                   message
                }
             }
          }
      }
 }

// Query variables
{
  catalogFeedId: createCatalogFeedResponseJson.data.id
}
Response
{
  "data": {
    "catalogFeed": {
      "id": "example-id",
      "status": "COMPLETED",
      "result": {
        "signals": [
          {
            "code": "MissingRequiredColumn",
            "signalMessage": {
              "locale": "en",
              "message": "Missing required column for External ID."
            },
            "impactSummary": {
              "locale": "en",
              "message": "The catalog feed could not be imported."
            },
            "reactionSummary": {
              "locale": "en",
              "message": "Ensure that the file you uploaded is a CSV file that uses the correct CSV template. https://amazon-omni-cdn.com/static/catalog/CreateCatalogFeed-template.csv"
            }
        ]
      }
    }
  }
}

Related topics