Ebay Search API
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();
}
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
},
............................
]
Last updated