LogoLogo
OverviewRelease NotesDataPipelineFAQs
Java
Java
  • Make Requests with ScraperAPI in Java
    • Use ScraperAPI Endpoint in Java
    • Use ScraperAPI Proxy Port in Java
    • Use ScraperAPI SDK in Java
    • Make Async Requests with ScraperAPI in Java
      • How to Use ScraperAPI Async Web Scraping in Java
      • Use Async ScraperAPI Callbacks in Java
      • Configure ScraperAPI Parameters in Java
      • Request Async Batch Scraping with ScraperAPI in Java
      • Decode Base64 Async Responses in Java
    • ScraperAPI Structured Data Collection in Java
      • Amazon Product Page API: Structured Data in Java
      • Amazon Search API: Structured Data in Java
      • Amazon Offers API: Structured Data in Java
      • Amazon Reviews API: Structured Data in Java
      • Ebay Product Page API: Structured Data in Java
      • Ebay Search API: Structured Data in Java
      • Google SERP API: Structured Data in Java
      • Google News API: Structured Data in Java
      • Google Jobs API: Structured Data in Java
      • Google Shopping API: Structured Data in Java
      • Google Maps Search API: Structured Data in Java
      • Redfin Agent Details API: Structured Data in Java
      • Redfin 'For Rent' Listings API: Structured Data in Java
      • Redfin 'For Sale' Listings API: Structured Data in Java
      • Redfin Listing Search API: Structured Data in Java
      • Walmart Search API: Structured Data in Java
      • Walmart Category API: Structured Data in Java
      • Walmart Product API: Structured Data in Java
      • Walmart Reviews API: Structured Data in Java
    • ScraperAPI Async Structured Data Collection in Java
      • Amazon Product Page API: Async Structured Data in Java
      • Amazon Search API: Async Structured Data in Java
      • Amazon Offers API: Async Structured Data in Java
      • Amazon Reviews API: Async Structured Data in Java
      • Ebay Product Page API: Async Structured Data in Java
      • Ebay Search API: Async Structured Data in Java
      • Google SERP API: Async Structured Data in Java
      • Google News API: Async Structured Data in Java
      • Google Jobs API: Async Structured Data in Java
      • Google Shopping API: Async Structured Data in Java
      • Google Maps Search API: Async Structured Data in Java
      • Redfin Agent Details API: Async Structured Data in Java
      • Redfin 'For Rent' Listings API: Async Structured Data in Java
      • Redfin 'For Sale' Listings API: Async Structured Data in Java
      • Redfin Listing Search API: Async Structured Data in Java
      • Walmart Search API: Async Structured Data in Java
      • Walmart Category API: Async Structured Data in Java
      • Walmart Product API: Async Structured Data in Java
      • Walmart Reviews API: Async Structured Data in Java
    • Making POST/PUT Requests with ScraperAPI in Java
    • Customizing ScraperAPI Requests in Java
      • Customize Amazon Requests by ZIP Code via ScraperAPI in Java
      • Customize Cached Results via ScraperAPI in Java
      • Customize Control Costs with ScraperAPI Parameter in Java
      • Send Custom Headers with ScraperAPI in Java
      • Customize Device Type with ScraperAPI in Java
      • Customize Geotargeted Content Scrape via ScraperAPI in Java
      • Customize Premium Geotargeted Scrape via ScraperAPI in Java
      • Customize Header Parameter with ScraperAPI in Java
      • Customize Premium Residential/Mobile Proxies in Java
      • Customize JavaScript-Rendered Pages via ScraperAPI in Java
        • Use Render Instruction Set to Scrape Dynamic Pages in Java
        • Customize Taking a Website Screenshots via ScraperAPI in Java
      • Customize Scrape Session-Based Proxies via ScraperAPI in Java
  • Handle and Process Responses via ScraperAPI in Java
    • Use API Status Codes to Retry Failed Requests in Java
    • Customize Output Formats via ScraperAPI Parameters in Java
      • Request JSON Response via Autoparse Parameter in Java
      • Request LLM Output Formats with ScraperAPI in Java
    • Request Response Encoding and Content-Type via ScraperAPI in Java
  • Dashboard & Billing
    • API Key
    • Credit Usage
    • Delete Account
    • Invoice History
    • Billing Email
    • Billing Address
    • VAT Number
    • Payment Method
    • Cancel Subscription
  • Credits and Requests
  • Monitor Your ScraperAPI Account Information in Java
  • Documentation Overview
Powered by GitBook

Quick links

  • Homepage
  • Dashboard
  • Pricing
  • Contact Sales

Resources

  • Developer Guides
  • Blog
  • Contact Support
  • Learning Hub
On this page

Was this helpful?

  1. Make Requests with ScraperAPI in Java
  2. ScraperAPI Structured Data Collection in Java

Ebay Search API: Structured Data in Java

Scrape eBay search results into structured JSON/CSV with ScraperAPI in Java. Filter by seller, condition, format, and price to power product research.

This endpoint will retrieve products for a specified search term from Ebay search page and transform it into usable JSON.

try {
String apiKey = "API_KEY";
String query = "QUERY";
String country_code = "COUNTRY_CODE";
String tld = "TLD";
String condition = "CONDITION";
String sort_by = "SORT_BY";
String page = "PAGE";
String items_per_page = "ITEMS_PER_PAGE";
String seller_id = "SELLER_ID";
String buying_format = "BUYING_FORMAT";
String show_only = "SHOW_ONLY";
String url = "https://api.scraperapi.com/structured/ebay/search?api_key=" + apiKey + 
"&product_id=" + product_id + "&country_code=" + country_code + "&tld=" + tld
+ "&condition=" + condition + "&sort_by=" + sort_by + "&page=" + page 
+ "&items_per_page=" + items_per_page + "&seller_id=" + seller_id
+ "&buying_format=" buying_format + "&show_only=" + show_only;
URL urlForGetRequest = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlForGetRequest.openConnection();
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuffer response = new StringBuffer();
String readLine;
while ((readLine = in.readLine()) != null) {
response.append(readLine);
}
in.close();
System.out.println(response.toString());
} else {
throw new Exception("Error in API Call");
}
} catch (Exception ex) {
ex.printStackTrace();
}

Parameters
Details

API_KEY (required)

User's normal API Key

QUERY (required)

Search query. Example: iPhone

TLD

Top-level Ebay domain to scrape. This is an optional argument and defaults to “com” (ebay.com). Valid values include:

com (ebay.com)

co.uk (ebay.co.uk)

com.au (ebay.com.au)

de (ebay.de)

ca (ebay.ca)

fr (ebay.fr)

it (ebay.it)

es (ebay.es)

at (ebay.at)

ch (ebay.ch)

com.sg (ebay.com.sg)

com.my (ebay.com.my)

ph (ebay.ph)

ie (ebay.ie)

pl (ebay.pl)

nl (ebay.nl)

COUNTRY

country_code influences the language and the currency of the page. The TLD should be set to ‘com’ if you are using languages that are not used by the TLDs listed above.

SORT_BY

Instructs the API to sort the results. Supported values:

ending_soonest newly_listed price_lowest price_highest distance_nearest best_match

PAGE

Page number

ITEMS_PER_PAGE

Number of items returned. Supported values: 60, 120, 240

SELLER_ID

The ‘name’ of the seller. This is a textual id, for example ‘gadget-solutions’

Filter options

CONDITON

Condition of the products. Supported values:

'new', 'used', 'open_box', 'refurbished', 'for_parts', 'not_working’ Note: These categories don’t have the same name for all products.

For example open_box is sometimes called ‘without tag’ on the eBay results page. Please ensure that you are always using the values from the supported list when sending request to the API. Note2: Multiple options can be used here. So if you want to search for new and open_box products you can use the query param: ’used,open_box’ in an URL encoded form like &condition=used%2Copen_box

BUYING_FORMAT

Buying format. Supported values:

buy_it_now auction accepts_offers Note: You can specify multiple options just as with the condition parameter.

SHOW_ONLY

Additional filters for search. Supported values:

returns_accepted authorized_seller completed_items sold_items sale_items listed_as_lots search_in_description benefits_charity authenticity_guarantee Note: Multiple options can be used here. So if you want to search for a product where returns are accepted and it’s from an authorized seller the query param: ’returns_accepted,authorized_seller’ in an URL encoded form like &show_only=returns_accepted%2Cauthorized_seller

Sample Response

[
  {
    "product_title": "Apple iPhone SE 2nd Gen (Great Cond) Unlocked AT&T TMobile Verizon 64 128 256 GBOpens in a new window or tab",
    "image": "https://i.ebayimg.com/images/g/GJMAAOSw3bBmaHw2/s-l500.webp",
    "product_url": "https://www.ebay.com/itm/226358814412",
    "condition": "Pre-Owned",
    "item_price": {
      "from": {
        "value": 147.99,
        "currency": "USD"
      },
      "to": {
        "value": 264.99,
        "currency": "USD"
      }
    },
    "extra_info": "Buy It Now",
    "free_returns": "Free returns",
    "watchers": 19,
    "seller_name": "cocosprinkles",
    "seller_rating_count": 32530,
    "seller_rating": 99.8,
    "seller_has_top_rated_plus": true
  },
  {
    "product_title": "Apple iPhone 8 (Great Condition) Unlocked AT&T Verizon T-Mobile 64GB 128GB 256GBOpens in a new window or tab",
    "image": "https://i.ebayimg.com/images/g/NXoAAOSwNIdmZw4e/s-l500.webp",
    "product_url": "https://www.ebay.com/itm/226358808865",
    "condition": "Pre-Owned",
    "item_price": {
      "from": {
        "value": 134.99,
        "currency": "USD"
      },
      "to": {
        "value": 214.99,
        "currency": "USD"
      }
    },
    "extra_info": "Buy It Now",
    "free_returns": "Free returns",
    "items_sold": 59,
    "seller_name": "cocosprinkles",
    "seller_rating_count": 32530,
    "seller_rating": 99.8,
    "seller_has_top_rated_plus": true
  },
  {
    "product_title": "Apple iPhone SE 2nd Gen 2020 64GB Unlocked Verizon At&t T-Mobile Fair ConditionOpens in a new window or tab",
    "image": "https://i.ebayimg.com/images/g/gg4AAOSw735mRYIO/s-l140.webp",
    "product_url": "https://www.ebay.com/itm/226378701013",
    "condition": "Pre-Owned · Apple iPhone SE (2nd Generation) · 64 GB · Unlocked",
    "item_price": {
      "value": 90,
      "currency": "USD"
    },
    "extra_info": "Buy It Now",
    "shipping_cost": "Free shipping",
    "watchers": 10,
    "seller_name": "esupplytech",
    "seller_rating_count": 4156,
    "seller_rating": 97.8
  },
  {
    "product_title": "Apple iPhone XR Black 128GB A1984 MT362LL/A Verizon Clean ESN Good (JF)Opens in a new window or tab",
    "image": "https://i.ebayimg.com/images/g/GAgAAOSwxDRitG-z/s-l140.webp",
    "product_url": "https://www.ebay.com/itm/195161489925",
    "condition": "Good - Refurbished · Apple iPhone XR · 128 GB · Verizon",
    "item_price": {
      "value": 143.96,
      "currency": "USD"
    },
    "extra_info": "Buy It Now",
    "free_returns": "Free returns",
    "seller_name": "auditmacstech",
    "seller_rating_count": 12440,
    "seller_rating": 99.2,
    "seller_has_top_rated_plus": true
  },
 ............................
]

PreviousEbay Product Page API: Structured Data in JavaNextGoogle SERP API: Structured Data in Java

Last updated 6 months ago

Was this helpful?