Ebay Product Page API (Async)
This endpoint will retrieve product data from an Ebay product pages (/itm/) and transform it into usable JSON.
Single product request:
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://async.scraperapi.com/structured/ebay/product')
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = {
apiKey: 'APIKEY',
productId: 'PRODUCTID',
country_code: 'COUNTRY_CODE',
tld: 'TLD',
callback: {
type: 'webhook',
url: 'CALLBACK'
}
}.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 products Request:
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://async.scraperapi.com/structured/ebay/product')
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = {
apiKey: 'APIKEY',
productIds: ['PRODUCTID1', 'PRODUCTID2'],
country_code: 'COUNTRY_CODE',
tld: 'TLD',
callback: {
type: 'webhook',
url: 'CALLBACK'
}
}.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
Sample Response
Single Product Request:
{
"id": "ad85f5f5-2e47-4d9b-bf6e-ed1e7e8ac53d",
"attempts": 0,
"status": "running",
"statusUrl": "https://async.scraperapi.com/jobs/ad85f5f5-2e47-4d9b-bf6e-ed1e7e8ac53d",
"productId": "315668246442",
"country_code": "us",
"tld": "com",
"supposedToRunAt": "2024-11-01T08:00:29.732Z"
}
Multiple Products Request:
{
"id": "44a7bf0f-3dfd-46ac-9fbd-b17905cbfa60",
"attempts": 0,
"status": "running",
"statusUrl": "https://async.scraperapi.com/jobs/44a7bf0f-3dfd-46ac-9fbd-b17905cbfa60",
"productId": "315668246442",
"country_code": "us",
"tld": "com"
},
{
"id": "5af00d62-70a0-40d3-bfd6-f79fa56887ee",
"attempts": 0,
"status": "running",
"statusUrl": "https://async.scraperapi.com/jobs/5af00d62-70a0-40d3-bfd6-f79fa56887ee",
"productId": "126718182209",
"country_code": "us",
"tld": "com"
}
Last updated