I am trying to get data using the Ebay API and a keyword for my items. For example, I used to be able to enter this...
https://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SECURITY-APPNAME=MYAPPNAME&keywords=CHEESE&itemFilter.name=Seller&itemFilter.value=MY_USER_ID
Each of my titles is unique, so if I wanted to search the titles of my items and find the one that had the word "cheese" in it, entering the URL above would show me data for that item. I'd get xml code showing the full title, selling price, itemID, etc.
Just recently, this stopped working. I don't think you can use the FindingAPI anymore, and I don't think you can enter this on a URL. Can I somehow use PHP and cURL to get the item data based on a keyword?
As of 2025/02/04, Ebay Finding API is decommissioned. You can check the status of the Ebay API's here.
Instead of the Finding API, you can use the Browse API. Specifically you can search items by keyword using the items_search
API end point.
Example:
https://api.ebay.com/buy/browse/v1/item_summary/search?q=cheese
Update based on the comment
You can finetune the search by using the various parameters. For example you can filter the results by specific sellers using the filter
parameter.
Example:
https://api.ebay.com/buy/browse/v1/item_summary/search?q=cheese&filter=sellers:{seller_1|seller_2}
Full Code
<?php
//generate token with your client_id and client_secret
$hash = base64_encode($client_id . ':' . $client_secret);
$oauth_url = "https://api.ebay.com/identity/v1/oauth2/token";
$post_fields = "grant_type=client_credentials&scope=https%3A%2F%2Fapi.ebay.com%2Foauth%2Fapi_scope";
// Make the curl request to get the access token
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $oauth_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Basic '.$hash));
$exec = curl_exec($ch);
$x = curl_error($ch);
$access_token = json_decode($exec)->access_token;
// Now make the request to the Browse API
$url = 'https://api.ebay.com/buy/browse/v1/item_summary/search?q=cheese&filter=sellers:{lehmans|jaymar718925|goafogo}';
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_HTTPHEADER, array( 'Authorization:Bearer '.$access_token));
$exec = curl_exec($ch);
$x = curl_error($ch);
echo '<pre>';
print_r(json_decode($exec));