cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ebay Browse API finding most but not all listings. Missing items

I have a fully functional application that is working with the Ebay Browse API. It retrieves the response for a given SKU, (almost) perfectly matching the results returned in a standard ebay search.

 

However, it often misses items. It is not my filtering that is missing the items, it is missing from the API response. That is, they are missing even after paginating through all the existing results. I don't believe there is an error with my pagination, but maybe?

 

The listings that are missing seem random. They are often auction items, but also items where there are multiple selection options. However, not all auction items or items with selection options are missing.

 

Examples for missing items when searching industrial electronics for 6FC5203-0AF05-1AB1:

Both these items are missing in the browse API, along with many others. However when you search for them in Ebay, they are there.

I have tried every combination of things like location setting, shipping location options, etc. None of these changes the result.

 

A few missing items might be okay, but these items are often the ones with the best prices. If the browse API does not let me browse all existing listings, then it is useless.

relevant code:

api_url = "https://api.ebay.com/buy/browse/v1/item_summary/search?"
        country_code = country.replace("EBAY-", "")
        zip_code_us = f"19064"
        zip_code_eur = f"9351VA"
        zip_code_de = f"40233"
        zip_code_uk = f"WS11%200ET"
        print(country)
        headers = {
            "Authorization": f"Bearer {token}",
            "Content-Type": "application/json",
            "Accept": "application/json",
        }

        # Include selected countries in the API call
        # &category_ids=12576
        query_string = f"q={query}&limit=200&sort=newlyListed"
        api_url += query_string
        headers["X-EBAY-C-MARKETPLACE-ID"] = f"{country}"
        if country_code == "US":
            headers["X-EBAY-C-ENDUSERCTX"] = (
                f"contextualLocation=country%3D{country_code}%2Czip%3D{zip_code_us}"
            )
        elif country_code == "DE":
            headers["X-EBAY-C-ENDUSERCTX"] = (
                f"contextualLocation=country%3D{country_code}%2Czip%3D{zip_code_de}"
            )
        elif country_code == "UK":
            headers["X-EBAY-C-ENDUSERCTX"] = (
                f"contextualLocation=country%3D{country_code}%2Czip%3D{zip_code_uk}"
            )
        elif country_code == "NL":
            headers["X-EBAY-C-ENDUSERCTX"] = (
                f"contextualLocation=country%3D{country_code}%2Czip%3D{zip_code_eur}"
            )

        # Make initial API call to get total results
        print(f"Sending query for {country}: {api_url}")
        response = requests.get(api_url, headers=headers)
        # if country:  #  == "EBAY-US":  # @NOTE: DEBUG
        #     # Open a text file in write mode ('w')
        #     with open("response-debugging-all.txt", "a", encoding="utf-8") as file:
        #         # Write the string to the file
        #         file.write(str(response.text))
        if response.status_code == 200:
            data = response.json()
            total_results = data.get("total", 0)
            if total_results > 200:
                print("Total results exceed 200. Paginating...")
                all_items = []
                for offset in range(0, total_results, 200):
                    print(f"Fetching items with offset: {offset}")
                    api_url_with_offset = f"{api_url}&offset={offset}"
                    response = requests.get(api_url_with_offset, headers=headers)
                    if response.status_code == 200:
                        items_data = response.json()
                        all_items.append(items_data)
                    else:
                        print(f"Failed to fetch items with offset {offset}")
                return all_items, country
            else:
                return [data], country
        else:
            print(f"Failed to make API call for {country}")
            return None

 

Any assistance would be appreciated.

Message 1 of 6
latest reply
5 REPLIES 5

Re: Ebay Browse API finding most but not all listings. Missing items

I'm encountering a similar issue. 

 

I'm building an app for a seller, and using the browse API / search to retrieve all items belonging to a particular category for that specific seller using these URL parameters:

next_url = f'{base_url}?category_ids={category_id}&limit={limit}&filter=sellers:{{{seller_username}}}&fieldgroups=EXTENDED'

I know the seller has about 1300 products in there matching my criteria.  It returns almost all of them, but there are always a few missing (usually around 10 or 20).  This sounds very much like the behavior you're also seeing, which makes me suspect the Browse API is not returning ALL results, or perhaps we're dealing with different servers / databases.

Like you, when I identify the missing items and manually view them on eBay, they are there.

I'm at a point now, where I'm going to change my code to do a second check on these items by calling each of them separately with getItem.

Message 2 of 6
latest reply

Re: Ebay Browse API finding most but not all listings. Missing items

If items were created by the Trading API the then those will not be returned by the REST API, are you sure missing products were not created by the Trading API?

C# wrapper for eBay REST API
https://github.com/Code-n-Cloud/EbaySharp
Message 3 of 6
latest reply

Re: Ebay Browse API finding most but not all listings. Missing items

I share with you the same experience. I know to say that definitely since I moved to use the new Browse API Item Summary Seacrh interface, I am NOT getting anything similar to what I should get (when compared to the web regular interface). SO DISAPPOINTING!

Message 4 of 6
latest reply

Re: Ebay Browse API finding most but not all listings. Missing items

And, just to make this clear, I do use the BuyingOptions filter as follows (to get all listings)

buyingOptions:{AUCTION|FIXED_PRICE}

Message 5 of 6
latest reply

Re: Ebay Browse API finding most but not all listings. Missing items

Me too, I have issues sometimes, on public web the seller I know has like 2400 products but the ebay API only returns 2250, and every time I call it some random 20/30 products are missing but then they appear in the next call and so on, always 20/30 products appear and disappear from the results

Message 6 of 6
latest reply