The Marketing API offers two platforms that sellers can use to promote and advertise their products: Promoted Listings is an eBay ad service that lets sellers set up ad campaigns for the products they want to promote. eBay displays the ads in search results and in other marketing modules as SPONSORED listings. If an item in a Promoted Listings campaign sells, the seller is assessed a Promoted Listings fee, which is a seller-specified percentage applied to the sales price. For complete details, see Promoted Listings. Promotions Manager gives sellers a way to offer discounts on specific items as a way to attract buyers to their inventory. Sellers can set up discounts (such as "20% off" and other types of offers) on specific items or on an entire customer order. To further attract buyers, eBay prominently displays promotion teasers throughout buyer flows. For complete details, see Promotions Manager. Marketing reports, on both the Promoted Listings and Promotions Manager platforms, give sellers information that shows the effectiveness of their marketing strategies. The data gives sellers the ability to review and fine tune their marketing efforts. Important! Sellers must have an active eBay Store subscription, and they must accept the Terms and Conditions before they can make requests to these APIs in the Production environment. There are also site-specific listings requirements and restrictions associated with these marketing tools, as listed in the "requirements and restrictions" sections for Promoted Listings and Promotions Manager. The table below lists all the Marketing API calls grouped by resource.
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-marketing-php-client.git"
}
],
"require": {
"zvps/ebay-sell-marketing-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\Marketing\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Ebay\Sell\Marketing\Api\AdApi(
// 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
);
$campaign_id = 'campaign_id_example'; // string | A unique eBay-assigned ID for an ad campaign that's generated when a campaign is created. Get a seller's campaign IDs by calling getCampaigns.
$body = new \Ebay\Sell\Marketing\Model\BulkCreateAdsByInventoryReferenceRequest(); // \Ebay\Sell\Marketing\Model\BulkCreateAdsByInventoryReferenceRequest | The container for the bulk request to create ads for eBay inventory reference IDs. eBay inventory reference IDs are seller-defined IDs used by theInventory API.
try {
$result = $apiInstance->bulkCreateAdsByInventoryReference($campaign_id, $body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AdApi->bulkCreateAdsByInventoryReference: ', $e->getMessage(), PHP_EOL;
}
All URIs are relative to https://api.ebay.com/sell/marketing/v1
Class | Method | HTTP request | Description |
---|---|---|---|
AdApi | bulkCreateAdsByInventoryReference | POST /ad_campaign/{campaign_id}/bulk_create_ads_by_inventory_reference | |
AdApi | bulkCreateAdsByListingId | POST /ad_campaign/{campaign_id}/bulk_create_ads_by_listing_id | |
AdApi | bulkDeleteAdsByInventoryReference | POST /ad_campaign/{campaign_id}/bulk_delete_ads_by_inventory_reference | |
AdApi | bulkDeleteAdsByListingId | POST /ad_campaign/{campaign_id}/bulk_delete_ads_by_listing_id | |
AdApi | bulkUpdateAdsBidByInventoryReference | POST /ad_campaign/{campaign_id}/bulk_update_ads_bid_by_inventory_reference | |
AdApi | bulkUpdateAdsBidByListingId | POST /ad_campaign/{campaign_id}/bulk_update_ads_bid_by_listing_id | |
AdApi | createAdByListingId | POST /ad_campaign/{campaign_id}/ad | |
AdApi | createAdsByInventoryReference | POST /ad_campaign/{campaign_id}/create_ads_by_inventory_reference | |
AdApi | deleteAd | DELETE /ad_campaign/{campaign_id}/ad/{ad_id} | |
AdApi | deleteAdsByInventoryReference | POST /ad_campaign/{campaign_id}/delete_ads_by_inventory_reference | |
AdApi | getAd | GET /ad_campaign/{campaign_id}/ad/{ad_id} | |
AdApi | getAds | GET /ad_campaign/{campaign_id}/ad | |
AdApi | getAdsByInventoryReference | GET /ad_campaign/{campaign_id}/get_ads_by_inventory_reference | |
AdApi | updateBid | POST /ad_campaign/{campaign_id}/ad/{ad_id}/update_bid | |
AdReportApi | getReport | GET /ad_report/{report_id} | |
AdReportMetadataApi | getReportMetadata | GET /ad_report_metadata | |
AdReportMetadataApi | getReportMetadataForReportType | GET /ad_report_metadata/{report_type} | |
AdReportTaskApi | createReportTask | POST /ad_report_task | |
AdReportTaskApi | deleteReportTask | DELETE /ad_report_task/{report_task_id} | |
AdReportTaskApi | getReportTask | GET /ad_report_task/{report_task_id} | |
AdReportTaskApi | getReportTasks | GET /ad_report_task | |
CampaignApi | cloneCampaign | POST /ad_campaign/{campaign_id}/clone | |
CampaignApi | createCampaign | POST /ad_campaign | |
CampaignApi | deleteCampaign | DELETE /ad_campaign/{campaign_id} | |
CampaignApi | endCampaign | POST /ad_campaign/{campaign_id}/end | |
CampaignApi | findCampaignByAdReference | GET /ad_campaign/find_campaign_by_ad_reference | |
CampaignApi | getCampaign | GET /ad_campaign/{campaign_id} | |
CampaignApi | getCampaignByName | GET /ad_campaign/get_campaign_by_name | |
CampaignApi | getCampaigns | GET /ad_campaign | |
CampaignApi | pauseCampaign | POST /ad_campaign/{campaign_id}/pause | |
CampaignApi | resumeCampaign | POST /ad_campaign/{campaign_id}/resume | |
CampaignApi | updateCampaignIdentification | POST /ad_campaign/{campaign_id}/update_campaign_identification | |
ItemPriceMarkdownApi | createItemPriceMarkdownPromotion | POST /item_price_markdown | |
ItemPriceMarkdownApi | deleteItemPriceMarkdownPromotion | DELETE /item_price_markdown/{promotion_id} | |
ItemPriceMarkdownApi | getItemPriceMarkdownPromotion | GET /item_price_markdown/{promotion_id} | |
ItemPriceMarkdownApi | updateItemPriceMarkdownPromotion | PUT /item_price_markdown/{promotion_id} | |
ItemPromotionApi | createItemPromotion | POST /item_promotion | |
ItemPromotionApi | deleteItemPromotion | DELETE /item_promotion/{promotion_id} | |
ItemPromotionApi | getItemPromotion | GET /item_promotion/{promotion_id} | |
ItemPromotionApi | updateItemPromotion | PUT /item_promotion/{promotion_id} | |
PromotionApi | getListingSet | GET /promotion/{promotion_id}/get_listing_set | |
PromotionApi | getPromotions | GET /promotion | |
PromotionApi | pausePromotion | POST /promotion/{promotion_id}/pause | |
PromotionApi | resumePromotion | POST /promotion/{promotion_id}/resume | |
PromotionReportApi | getPromotionReports | GET /promotion_report | |
PromotionSummaryReportApi | getPromotionSummaryReport | GET /promotion_summary_report |
- Ad
- AdIds
- AdPagedCollection
- AdReference
- AdReferences
- AdResponse
- Ads
- Amount
- BaseResponse
- BulkAdResponse
- BulkCreateAdRequest
- BulkCreateAdsByInventoryReferenceRequest
- BulkCreateAdsByInventoryReferenceResponse
- BulkDeleteAdRequest
- BulkDeleteAdResponse
- BulkDeleteAdsByInventoryReferenceRequest
- BulkDeleteAdsByInventoryReferenceResponse
- Campaign
- CampaignCriterion
- CampaignPagedCollection
- Campaigns
- CloneCampaignRequest
- CouponConfiguration
- CreateAdRequest
- CreateAdsByInventoryReferenceRequest
- CreateAdsByInventoryReferenceResponse
- CreateCampaignRequest
- CreateReportTask
- DeleteAdRequest
- DeleteAdResponse
- DeleteAdsByInventoryReferenceRequest
- DeleteAdsByInventoryReferenceResponse
- Dimension
- DimensionKeyAnnotation
- DimensionMetadata
- DiscountBenefit
- DiscountRule
- DiscountSpecification
- Error
- ErrorParameter
- FundingStrategy
- InventoryCriterion
- InventoryItem
- InventoryReference
- ItemPriceMarkdown
- ItemPromotion
- ItemPromotionResponse
- MetricMetadata
- PromotionDetail
- PromotionReportDetail
- PromotionsPagedCollection
- PromotionsReportPagedCollection
- ReportMetadata
- ReportMetadatas
- ReportTask
- ReportTaskPagedCollection
- RuleCriteria
- SelectedInventoryDiscount
- SelectionRule
- SummaryReportResponse
- UpdateBidPercentageRequest
- UpdateCampaignIdentificationRequest
- Type:
OAuth
- Flow:
accessCode
- Authorization URL:
https://auth.ebay.com/oauth2/authorize
- Scopes:
- https://api.ebay.com/oauth/api_scope/sell.marketing.readonly: View your eBay marketing activities, such as ad campaigns and listing promotions
- https://api.ebay.com/oauth/api_scope/sell.marketing: View and manage your eBay marketing activities, such as ad campaigns and listing promotions
- Type:
OAuth
- Flow:
application
- Authorization URL: ``
- Scopes:
- https://api.ebay.com/oauth/api_scope: View public data from eBay
To run the tests, use:
composer install
vendor/bin/phpunit
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
v1.10.0
- Package version:
5.0.0
- Package version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen