Product Selector

https://dtrnk0o2zy01c.cloudfront.net/openapi/en-us/dest/ProductSelector_prod_3p.json

The Amazon Product Selector API allows integrators to receive product metadata such as inventory status, price, eligibility status and product details for SKUS or ASINs in their Product Catalog in order to launch, manage or optimize Sponsored Product, Sponsored Brands or Sponsored Display advertising campaigns. The Product Selector API is available to Sellers, Vendors, and Authors.

class ad_api.api.Metadata(account='default', marketplace: Marketplaces = Marketplaces.EU, credentials=None, proxies=None, verify=True, timeout=None, debug=False, access_token=None)
get_products_metadata(body: dict, str) ApiResponse

Returns product metadata for the advertiser.

body: | REQUIRED

asins’: list>string, {‘description’: ‘Specific asins to search for in the advertiser’s inventory. Cannot use together with skus or searchStr input types.’}

checkItemDetails’: boolean, {‘description’: ‘Whether item details such as name, image, and price is required. default: false’}

cursorToken’: string, {‘description’: ‘Pagination token used for the suggested sort type’}

adType’: string, {‘description’: ‘Program type. Required if checks advertising eligibility. Enum: [ SP, SB, SD ]’}

skus’: list>string, {‘description’: ‘Specific skus to search for in the advertiser’s inventory. Currently only support SP program type for sellers. Cannot use together with asins or searchStr input types’}

checkEligibility’: boolean, {‘description’: ‘Whether advertising eligibility info is required. default: false’}

searchStr’: string, {‘description’: ‘Specific string in the item title to search for in the advertiser’s inventory. Case insensitive. Cannot use together with asins or skus input types’}

pageIndex’: integer($int32), {‘description*’: ‘Index of the page to be returned’}

sortOrder’: string, {‘description’: ‘Sort order (has to be DESC for the suggested sort type). default: DESC. Enum [ ASC, DESC ]’}

pageSize’: integer($int32), {‘description*’: ‘Number of items to be returned on this page index (max 100 for author)’}

sortBy’: string, {‘description’: ‘Sort option for the result. Currently only support SP program type for sellers. Enum [ SUGGESTED, CREATED_DATE ]’}

Returns:

ApiResponse

### Example getting the metadata of a search string

import logging
from ad_api.api import Metadata
from ad_api.base import AdvertisingApiException


logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s:%(levelname)s:%(message)s"
)


def get_products_metadata(data: (str, dict)):

    try:

        result = Metadata(debug=True).get_products_metadata(
            body=data
        )

        logging.info(result)

        product_metadata_list = result.payload.get("ProductMetadataList")

        logging.info(len(product_metadata_list))

        for product_metadata in product_metadata_list:
            logging.info(product_metadata)

    except AdvertisingApiException as error:
        logging.info(error)


if __name__ == '__main__':

    search_dict = \
        {
            'checkItemDetails': True,
            'adType': 'SP',
            'checkEligibility': True,
            'searchStr': 'obd2',
            'pageIndex': 1,
            'pageSize': 20,
            'sortBy': 'CREATED_DATE',
            'locale': 'es_ES'
        }

    get_products_metadata(search_dict)