Eligibility

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

Check advertising eligibility of products.

class ad_api.api.Eligibility(account='default', marketplace: Marketplaces = Marketplaces.EU, credentials=None, proxies=None, verify=True, timeout=None, debug=False, access_token=None)
get_eligibility_assistant(asin_list: list, sku_list: list = None, ad_type: str = 'sp', locale: str = 'en-GB') ApiResponse

Gets a list of advertising eligibility objects for a set of products. Requests are permitted only for products sold by the merchant associated with the profile. Note that the request object is a list of ASINs, but multiple SKUs are returned if there is more than one SKU associated with an ASIN. If a product is not eligible for advertising, the response includes an object describing the reasons for ineligibility.

asin_list: ‘A list of ASIN: An Amazon product identifier.’
sku_list: ‘A list of SKU: A seller product identifier’
adType: string, {‘description’: ‘Set to ‘sp’ to check product eligibility for Sponsored Products advertisements. Set to ‘sb’ to check product eligibility for Sponsored Brands advertisements. default: sp. [ sp, sb ]’}
locale’: string, {‘description’: ‘Set to the locale string in the table below to specify the language in which the response is returned. default: en_GB’}

Returns:

ApiResponse

### Example getting the elegibility of asin and asin/sku

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


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


def get_eligibility_assistant(**kwargs):

    try:

        result = Eligibility(debug=True).get_eligibility_assistant(
            **kwargs
        )

        logging.info(result)

    except AdvertisingApiException as error:
        logging.info(error)



if __name__ == '__main__':

    d_asin_list = ['B08C1KN5J2', 'B08XM9C8P6']
    d_sku_list = ['SKU-OF-B08C1KN5J2', 'SKU-OF-B08XM9C8P6']
    type_ad = 'sb'
    lang = 'es_ES'

    get_eligibility_assistant(asin_list=d_asin_list, sku_list=d_sku_list, ad_type=type_ad, locale=lang)

    # only by ASIN will return all available sku and show the eligibility
    get_eligibility_assistant(asin_list=d_asin_list, locale=lang)
    # the minimal call must send at least a list with one ASIN. Default: (adType="sp", locale="en-GB")
    get_eligibility_assistant(asin_list=['B08C1KN5J2'])
get_eligibility(body: dict, str) ApiResponse

Gets a list of advertising eligibility objects for a set of products. Requests are permitted only for products sold by the merchant associated with the profile. Note that the request object is a list of ASINs, but multiple SKUs are returned if there is more than one SKU associated with an ASIN. If a product is not eligible for advertising, the response includes an object describing the reasons for ineligibility.

body: | REQUIRED

adType’: string, {‘description’: ‘Set to ‘sp’ to check product eligibility for Sponsored Products advertisements. Set to ‘sb’ to check product eligibility for Sponsored Brands advertisements. default: sp. [ sp, sb ]’}

productDetailsList’: dict, {‘asin*’: ‘An Amazon product identifier.’, ‘sku’: ‘A seller product identifier’}

locale’: string, {‘description’: ‘Set to the locale string in the table below to specify the language in which the response is returned.’}

Returns:

ApiResponse

### Example getting the elegibility in the regular way sending a dict

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

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

    try:

        result = Eligibility(debug=True).get_eligibility(
            body=data
        )

        logging.info(result)


    except AdvertisingApiException as error:
        logging.info(error)

if __name__ == '__main__':

    dict_asin = \
        {
            'adType': 'sp',
            'productDetailsList': [
                {
                    'asin': 'B08C1KN5J2'
                }
            ],
            'locale': 'es-ES'
        }

    get_eligibility(dict_asin)

    dict_asin_sku = \
        {
            'adType': 'sp',
            'productDetailsList': [
                {
                    'asin': 'B08C1KN5J2',
                    'sku': 'SKU-OF-B08C1KN5J2'
                }
            ],
            'locale': 'es-ES'
        }

    get_eligibility(dict_asin_sku)

    dict_multiple_asin_sku = \
        {
            'adType': 'sp',
            'productDetailsList': [
                {
                    'asin': 'B08C1KN5J2',
                    'sku': 'SKU-OF-B08C1KN5J2'
                },
                {
                    'asin': 'B08XM9C8P6',
                    'sku': 'SKU-OF-B08XM9C8P6'
                }

            ],
            'locale': 'es-ES'
        }

    get_eligibility(dict_multiple_asin_sku)