BingAdsApiBundle
The BingAdsApiBundle provides a simple integration of the Bing Ads API for your Symfony project., (*1)
Checkout the Bing Ads full documentation, (*2)
Warning: Currently in development, (*3)
, (*4)
TODO
- Create more Reports, (*5)
Installation
With composer, add:, (*6)
{
"require": {
"werkspot/bing-ads-api-bundle": "dev-master"
}
}
Then enable it in your kernel:, (*7)
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
//...
new Werkspot\BingAdsApiBundle\WerkspotBingAdsApiBundle(),
//...
Configuration
# app/config/config.yml
# Bing ads API
werkspot_bing_ads_api:
cache_dir: "%kernel.cache_dir%" #<-- optional
Usage
The bundle registers the werkspot.bing_ads_api_client service witch allows you to call the api;, (*8)
Get Report
use BingAds\Reporting\ReportTimePeriod;
$reportType = 'GeoLocationPerformanceReportRequest';
$timePeriod = ReportTimePeriod::LastMonth;
$columns = [
'TimePeriod',
'AccountName',
'AdGroupId',
'AdGroupName',
'Impressions',
'Clicks',
'CurrencyCode',
'Spend',
'Country',
'City',
'State',
'MetroArea',
'MostSpecificLocation',
];
$apiDetails = new ApiDetails(
'refreshToken',
'clientId',
'secret',
'redirectUri',
'devToken'
);
$bingApi = $this->get('werkspot.bing_ads_api_client');
$bingApi->setApiDetails($apiDetails);
$arrayOfFiles = $bingApi->get($columns, $reportType, $timePeriod );
/* [...] Do something with the list */
$bingApi->clearCache(); //-- When done remove the files
$newRefreshToken = $bingApi->getRefreshToken() //-- Get new RefreshToken
Credits
BingAdsApiBundle is based on the officical Bing Ads API.
BingAdsApiBundle has been developed by LauLaman., (*9)