LogoLogo
OverviewRelease NotesDataPipelineFAQs
Ruby
Ruby
  • Make Requests with ScraperAPI in Ruby
    • Use ScraperAPI Endpoint in Ruby
    • Use ScraperAPI Proxy Port in Ruby
    • Use ScraperAPI SDK in Ruby
    • Make Async Requests with ScraperAPI in Ruby
      • How to Use ScraperAPI Async Web Scraping in Ruby
      • Use Async ScraperAPI Callbacks in Ruby
      • Configure ScraperAPI Parameters in Ruby
      • Request Async Batch Scraping with ScraperAPI in Ruby
      • Decode Base64 Async Responses in Ruby
    • ScraperAPI Structured Data Collection in Ruby
      • Amazon Product Page API: Structured Data in Ruby
      • Amazon Search API: Structured Data in Ruby
      • Amazon Offers API: Structured Data in Ruby
      • Amazon Reviews API: Structured Data in Ruby
      • Ebay Product Page API: Structured Data in Ruby
      • Ebay Search API: Structured Data in Ruby
      • Google SERP API: Structured Data in Ruby
      • Google News API: Structured Data in Ruby
      • Google Jobs API: Structured Data in Ruby
      • Google Shopping API: Structured Data in Ruby
      • Google Maps Search API: Structured Data in Ruby
      • Redfin Agent Details API: Structured Data in Ruby
      • Redfin 'For Rent' Listings API: Structured Data in Ruby
      • Redfin 'For Sale' Listings API: Structured Data in Ruby
      • Redfin Listing Search API: Structured Data in Ruby
      • Walmart Search API: Structured Data in Ruby
      • Walmart Category API: Structured Data in Ruby
      • Walmart Product API: Structured Data in Ruby
      • Walmart Reviews API: Structured Data in Ruby
    • ScraperAPI Async Structured Data Collection in Ruby
      • Amazon Product Page API: Async Structured Data in Ruby
      • Amazon Search API: Async Structured Data in Ruby
      • Amazon Offers API: Async Structured Data in Ruby
      • Amazon Reviews API: Async Structured Data in Ruby
      • Ebay Product Page API: Async Structured Data in Ruby
      • Ebay Search API: Async Structured Data in Ruby
      • Google SERP API: Async Structured Data in Ruby
      • Google News API: Async Structured Data in Ruby
      • Google Jobs API: Async Structured Data in Ruby
      • Google Shopping API: Async Structured Data in Ruby
      • Google Maps Search API: Async Structured Data in Ruby
      • Redfin Agent Details API: Async Structured Data in Ruby
      • Redfin 'For Rent' Listings API: Async Structured Data in Ruby
      • Redfin 'For Sale' Listings API: Async Structured Data in Ruby
      • Redfin Listing Search API: Async Structured Data in Ruby
      • Walmart Search API: Async Structured Data in Ruby
      • Walmart Category API: Async Structured Data in Ruby
      • Walmart Product API: Async Structured Data in Ruby
      • Walmart Reviews API: Async Structured Data in Ruby
    • Making POST/PUT Requests with ScraperAPI in Ruby
    • Customizing ScraperAPI Requests in Ruby
      • Customize Amazon Requests by ZIP Code via ScraperAPI in Ruby
      • Customize Cached Results via ScraperAPI in Ruby
      • Customize Control Costs with ScraperAPI Parameter in Ruby
      • Send Custom Headers with ScraperAPI in Ruby
      • Customize Device Type with ScraperAPI in Ruby
      • Customize Geotargeted Content Scrape via ScraperAPI in Ruby
      • Customize Premium Geotargeted Scrape via ScraperAPI in Ruby
      • Customize Header Parameter with ScraperAPI in Ruby
      • Customize Premium Residential/Mobile Proxies in Ruby
      • Customize JavaScript-Rendered Pages via ScraperAPI in Ruby
        • Use Render Instruction Set to Scrape Dynamic Pages in Ruby
        • Customize Taking a Website Screenshots via ScraperAPI in Ruby
      • Customize Scrape Session-Based Proxies via ScraperAPI in Ruby
  • Handle and Process Responses via ScraperAPI in Ruby
    • Use API Status Codes to Retry Failed Requests in Ruby
    • Customize Output Formats via ScraperAPI Parameters in Ruby
      • Request JSON Response via Autoparse Parameter in Ruby
      • Request LLM Output Formats with ScraperAPI in Ruby
    • Request Response Encoding and Content-Type via ScraperAPI in Ruby
  • 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 Ruby
  • 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 Ruby
  2. ScraperAPI Async Structured Data Collection in Ruby

Ebay Search API: Async Structured Data in Ruby

Scrape eBay search results into structured JSON/CSV with ScraperAPI async in Ruby. 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.

Single Query request:

require 'net/http'
require 'json'
require 'uri'
uri = URI('https://async.scraperapi.com/structured/ebay/search')
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = {
  apiKey: 'API_KEY',
  query: 'QUERY',
  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',
  callback: {
    type: 'webhook',
    url: 'YYYY'
  }
}.to_json
begin
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
  end
  puts response.body
rescue => e
  puts "Error: #{e.message}"
end

Multiple Query request:

require 'net/http'
require 'json'
require 'uri'
uri = URI('https://async.scraperapi.com/structured/ebay/search')
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = {
  apiKey: 'API_KEY',
  queries: ['QUERY1', 'QUERY2'],
  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',
  callback: {
    type: 'webhook',
    url: 'YYYY'
  }
}.to_json
begin
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
  end
  puts response.body
rescue => e
  puts "Error: #{e.message}"
end

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

Single Query Request:

{                          
  "id": "28cd7eb4-b1a1-4f99-b843-c9c8217d8a46",
  "attempts": 0,           
  "status": "running",     
  "statusUrl": "https://async.scraperapi.com/jobs/28cd7eb4-b1a1-4f99-b843-c9c8217d8a46",
  "query": "iphone",    
  "sort_by": "price_lowest",  
  "supposedToRunAt": "2024-11-11T10:18:01.316Z"
}

Multiple Query Request:

[                                                                                                                                                                                                                                                                                                                             
  {
    "id": "cb102a9b-d294-4172-b1b2-1c5b9f4b47df",
    "attempts": 0,
    "status": "running",
    "statusUrl": "https://async.scraperapi.com/jobs/cb102a9b-d294-4172-b1b2-1c5b9f4b47df",
    "query": "iphone",
    "sort_by": "price_lowest"
  },
  {
    "id": "e4abe7b8-9f71-4bcd-ae43-f2479aff013a",
    "attempts": 0,
    "status": "running",
    "statusUrl": "https://async.scraperapi.com/jobs/e4abe7b8-9f71-4bcd-ae43-f2479aff013a",
    "query": "android",
    "sort_by": "price_lowest"
  }
]

PreviousEbay Product Page API: Async Structured Data in RubyNextGoogle SERP API: Async Structured Data in Ruby

Last updated 6 months ago

Was this helpful?