Ebay Search API (Async)
This endpoint will retrieve products for a specified search term from Ebay search page and transform it into usable JSON.
Single Query request:
<?php
$curl = curl_init();
$data = json_encode(array(
'apiKey' => 'API_KEY',
'query' => 'QUERY',
'country_code' => 'COUNTRY',
'tld' => 'TLD',
'sort_by' => 'SORT_BY',
'page' => 'PAGE',
'items_per_page' => 'ITEMS_PER_PAGE',
'seller_id' => 'SELLER_ID',
'condition' => 'CONDITION',
'buying_format' => 'BUYING_FORMAT',
'show_only' => 'SHOW_ONLY',
'callback' => array(
'type' => 'webhook',
'url' => 'YYYY'
)
));
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://async.scraperapi.com/structured/ebay/search',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
CURLOPT_SSL_VERIFYPEER => false,
));
$response = curl_exec($curl);
if (curl_errno($curl)) {
echo 'Error:' . curl_error($curl);
} else {
echo $response;
}
curl_close($curl);
?>
Multiple Query request:
<?php
$curl = curl_init();
$data = json_encode(array(
'apiKey' => 'API_KEY',
'queries' => ['QUERY1', 'QUERY2'],
'country_code' => 'COUNTRY',
'tld' => 'TLD',
'sort_by' => 'SORT_BY',
'page' => 'PAGE',
'items_per_page' => 'ITEMS_PER_PAGE',
'seller_id' => 'SELLER_ID',
'condition' => 'CONDITION',
'buying_format' => 'BUYING_FORMAT',
'show_only' => 'SHOW_ONLY',
'callback' => array(
'type' => 'webhook',
'url' => 'YYYY'
)
));
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://async.scraperapi.com/structured/ebay/search',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
CURLOPT_SSL_VERIFYPEER => false,
));
$response = curl_exec($curl);
if (curl_errno($curl)) {
echo 'Error:' . curl_error($curl);
} else {
echo $response;
}
curl_close($curl);
?>
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"
}
]
Last updated