Copy require 'net/http'
require 'json'
require 'uri'
uri = URI ( 'https://async.scraperapi.com/structured/walmart/product' )
request = Net :: HTTP :: Post . new (uri , 'Content-Type' => 'application/json' )
request . body = {
apiKey: 'APIKEY' ,
productId: 'PRODUCTID' ,
tld: 'TLD' ,
output_format: 'FORMAT' ,
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
Copy require 'net/http'
require 'json'
require 'uri'
uri = URI ( 'https://async.scraperapi.com/structured/walmart/product' )
request = Net :: HTTP :: Post . new (uri , 'Content-Type' => 'application/json' )
request . body = {
apiKey: 'APIKEY' ,
productIds: [ 'PRODUCTID1' , 'PRODUCTID2' ] ,
tld: 'TLD' ,
output_format: 'FORMAT' ,
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
Copy {
"id" : "ee3aaa48-e630-487f-b6cb-ad85c7e2d4bd" ,
"status" : "running" ,
"statusUrl" : "https://async.scraperapi.com/jobs/ee3aaa48-e630-487f-b6cb-ad85c7e2d4bd" ,
"product_id" : "65EDSZVED3NS" ,
}
Copy [
{
"id" : "1cbf118f-54c8-41ae-94d4-b63cd1636000" ,
"status" : "running" ,
"statusUrl" : "https://async.scraperapi.com/jobs/1cbf118f-54c8-41ae-94d4-b63cd1636000" ,
"product_id" : "65EDSZVED3NS"
} ,
{
"id" : "9b346892-e9ad-4b19-a9e3-1e1364d12e9d" ,
"status" : "running" ,
"statusUrl" : "https://async.scraperapi.com/jobs/9b346892-e9ad-4b19-a9e3-1e1364d12e9d" ,
"product_id" : "41FV2JGSJPXI"
}
]
After the job(s) finish, you will find the result under the response key in the response JSON object. The structure is the same as in the corresponding SYNC data endpoint.