The Recommendation API returns information that sellers can use to optimize the configuration of their listings on eBay. Currently, the API contains a single method, findListingRecommendations. This method provides information that sellers can use to configure Promoted Listings ad campaigns to maximize the visibility of their items in the eBay marketplace.
PHP 7.2 and later.
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "vcs",
"url": "https://github/zvps/ebay-sell-recommendation-php-client.git"
}
],
"require": {
"zvps/ebay-sell-recommendation-php-client": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: Authorization Code
$config = Ebay\Sell\Recommendation\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Ebay\Sell\Recommendation\Api\ListingRecommendationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$x_ebay_c_marketplace_id = 'x_ebay_c_marketplace_id_example'; // string | Use this header to specify the eBay marketplace where you list the items for which you want to get recommendations.
$filter = 'filter_example'; // string | Provide a list of key-value pairs to specify the criteria you want to use to filter the response. In the list, separate each filter key from its associated value with a colon (":"). Currently, the only supported filter value is recommendationTypes and it supports only the ("AD") type. Follow the recommendationTypes specifier with the filter type(s) enclosed in curly braces ("{ }"), and separate multiple types with commas. Example: filter=recommendationTypes:{AD} Default: recommendationTypes:{AD}
$limit = 56; // int | Use this query parameter to set the maximum number of ads to return on a page from the paginated response. Default: 10 Maximum: 500
$offset = 56; // int | Specifies the number of ads to skip in the result set before returning the first ad in the paginated response. Combine offset with the limit query parameter to control the items returned in the response. For example, if you supply an offset of 0 and a limit of 10, the first page of the response contains the first 10 items from the complete list of items retrieved by the call. If offset is 10 and limit is 20, the first page of the response contains items 11-30 from the complete result set. Default: 0
$body = new \Ebay\Sell\Recommendation\Model\FindListingRecommendationRequest(); // \Ebay\Sell\Recommendation\Model\FindListingRecommendationRequest
try {
$result = $apiInstance->findListingRecommendations($x_ebay_c_marketplace_id, $filter, $limit, $offset, $body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ListingRecommendationApi->findListingRecommendations: ', $e->getMessage(), PHP_EOL;
}
All URIs are relative to https://api.ebay.com/sell/recommendation/v1
Class | Method | HTTP request | Description |
---|---|---|---|
ListingRecommendationApi | findListingRecommendations | POST /find |
- Ad
- BidPercentages
- FindListingRecommendationRequest
- ListingRecommendation
- MarketingRecommendation
- PagedListingRecommendationCollection
- Type:
OAuth
- Flow:
accessCode
- Authorization URL:
https://auth.ebay.com/oauth2/authorize
- Scopes:
- https://api.ebay.com/oauth/api_scope/sell.inventory: View and manage your inventory and offers
To run the tests, use:
composer install
vendor/bin/phpunit
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
1.1.0
- Package version:
5.0.0
- Package version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen