Thursday, April 18, 2013

Digest for adsense-api@googlegroups.com - 7 Messages in 1 Topic

Group: http://groups.google.com/group/adsense-api/topics

    Sean <neolocutus@gmail.com> Apr 16 03:13PM -0700  

    I've been using this page to make sure I'm using everything correctly to
    make the adUnit:
    https://developers.google.com/adsense/host/v4.1/accounts/adunits/insert
     
    accountID: pub-25716040XXXXXXXX
    adClientID: 74197XXXXXXXX.apps.googleusercontent.com
     
    I filled out the fancy html5 box for defining an adUnit to come up with this
     
    {
    "kind": "adsensehost#adUnit",
    "name": "qq",
    "contentAdsSettings": {
    "size": "SIZE_160_600",
    "type": "TEXT"
    },
    "code": "hjktrdres421rew",
    "id": "jhftderszzresw5r56"
    }
     
    And it still comes back with this.
     
    503 Service Unavailable
     
     
    {
    "error": {
    "errors": [
    {
    "domain": "global",
    "reason": "backendError",
    "message": "Backend Error"
    }
    ],
    "code": 503,
    "message": "Backend Error"
    }
    }
     
     
    I think I'm using all the proper everything to make the adUnits right? Then
    once I create them, I can run the getAdCode function to get the actual
    Javascript for them correct?
     
    Sean
     
     
     
     
     
    On Tuesday, April 16, 2013 2:39:31 AM UTC-6, Jose Alcérreca (AdSense API
    Team) wrote:

     

    "Jose Alcérreca (AdSense API Team)" <adsenseapiadvisor+jose@google.com> Apr 17 04:07AM -0700  

    Hi Sean,
     
    The problem in that case is that you're not inserting a complete ad unit.
    Please check the samples to see how to define it correctly. Your first code
    in PHP looks good.
     
    Cheers,
    Jose
     
    ---
    Jose Alcérreca
    Developer Relations
     
    Google UK Limited
    Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W
    9TQ
    Registered in England Number: 3977902
     
     
    Google Inc.| Developer Relations | *AdSense API Team* |
    developers.google.com/**adsense <https://developers.google.com/adsense/>
     
    On Tuesday, 16 April 2013 23:13:33 UTC+1, Sean wrote:

     

    Sean <neolocutus@gmail.com> Apr 17 09:45AM -0700  

    I'm still having problems getting this to work though using the sample PHP
    code. I'm plugging in all the numbers and I can't seem to make it work. Is
    there anything I'm missing here? I still don't know why it is giving me the
    (404) Ad client not found when I try and insert the ad.
     
     
    I set up the ad unit as so.
     
    $adUnit = new Google_AdUnit();
    $adUnit->setName('Test 1');
     
    $contentAdsSettings = new Google_AdUnitContentAdsSettings();
    $backupOption = new Google_AdUnitContentAdsSettingsBackupOption();
    $backupOption->setType('COLOR');
    $backupOption->setColor('ffffff');
    $contentAdsSettings->setBackupOption($backupOption);
    $contentAdsSettings->setSize('SIZE_160_600'); //width then height
    //ledarboard
    $contentAdsSettings->setType('TEXT');
    $adUnit->setContentAdsSettings($contentAdsSettings);
     
    $customStyle = new Google_AdStyle();
    $colors = new Google_AdStyleColors();
    $colors->setBackground('ffffff');
    $colors->setBorder('000000');
    $colors->setText('000000');
    $colors->setTitle('000000');
    $colors->setUrl('0000ff');
    $customStyle->setColors($colors);
    $customStyle->setCorners('SQUARE');
    $font = new Google_AdStyleFont(); //added Google_ to tihs to make it
    work
    $font->setFamily('ACCOUNT_DEFAULT_FAMILY');
    $font->setSize('ACCOUNT_DEFAULT_SIZE');
    $customStyle->setFont($font);
    $adUnit->setCustomStyle($customStyle);
     
    //print the ad unit to make sure it's all good.
    print_r($adUnit);
    echo "<BR><BR>";
     
    print out the vars I'm using to make sure it's right
     
    echo "clientid: " . $clientID . "<BR>";
    echo "pubID: " . $pubID . "<BR>";
    echo "thisAdClientID: " . $thisAdClientID . "<BR>";
     
    //now do the insert
    $result = $adsensehostService->accounts_adunits->insert($pubID,
    $clientID, $adUnit); // $clientID $thisAdClientID $clientID $pubID

    echo "<BR><BR>r: " . $result . "<BR>xx<BR>";
     
     
     
     
    Google_AdUnit Object ( [code] => [__contentAdsSettingsType:protected] =>
    Google_AdUnitContentAdsSettings [__contentAdsSettingsDataType:protected] =>
    [contentAdsSettings] => Google_AdUnitContentAdsSettings Object (
    [__backupOptionType:protected] =>
    Google_AdUnitContentAdsSettingsBackupOption
    [__backupOptionDataType:protected] => [backupOption] =>
    Google_AdUnitContentAdsSettingsBackupOption Object ( [color] => ffffff
    [type] => COLOR [url] => ) [size] => SIZE_160_600 [type] => TEXT )
    [__customStyleType:protected] => Google_AdStyle
    [__customStyleDataType:protected] => [customStyle] => Google_AdStyle Object
    ( [__colorsType:protected] => Google_AdStyleColors
    [__colorsDataType:protected] => [colors] => Google_AdStyleColors Object (
    [background] => ffffff [border] => 000000 [text] => 000000 [title] =>
    000000 [url] => 0000ff ) [corners] => SQUARE [__fontType:protected] =>
    Google_AdStyleFont [__fontDataType:protected] => [font] =>
    Google_AdStyleFont Object ( [family] => ACCOUNT_DEFAULT_FAMILY [size] =>
    ACCOUNT_DEFAULT_SIZE ) [kind] => ) [id] => [kind] =>
    [__mobileContentAdsSettingsType:protected] =>
    Google_AdUnitMobileContentAdsSettings
    [__mobileContentAdsSettingsDataType:protected] =>
    [mobileContentAdsSettings] => [name] => Test 1 [status] => )
     
    clientid: 7419718XXXXX.apps.googleusercontent.com
    pubID: pub-25716040709XXXXXX
    thisAdClientID: ca-host-pub-158312780XXXXXX
     
    Fatal error: Uncaught exception 'Google_ServiceException' with message
    'Error calling POST
    https://www.googleapis.com/adsensehost/v4.1/accounts/pub-2571604070xxxxx/adclients/741971xxxxxxx.apps.googleusercontent.com/adunits?key=AIzaSyDC9eQ8QIO_cTLJvkxQXXXXXXXXwc5-E:
    (404) Ad client not found.' in
    D:\Inetpub\wwwroot\site\_googleapi\src\io\Google_REST.php:66 Stack trace:
    #0 D:\Inetpub\wwwroot\site\_googleapi\src\io\Google_REST.php(36):
    Google_REST::decodeHttpResponse(Object(Google_HttpRequest)) #1
    D:\Inetpub\wwwroot\site\_googleapi\src\service\Google_ServiceResource.php(186):
    Google_REST::execute(Object(Google_HttpRequest)) #2
    D:\Inetpub\wwwroot\site\_googleapi\src\contrib\Google_AdsensehostService.php(198):
    Google_ServiceResource->__call('insert', Array) #3
    D:\Inetpub\wwwroot\site\_googleapi\api\build-ads-single.php(153):
    Google_AccountsAdunitsServiceResource->insert('pub-257160xxxxx...',
    '7419718xxxxxx.ap...', Object(Google_AdUnit)) #4 {main} thrown in
    D:\Inetpub\wwwroot\site\_googleapi\src\io\Google_REST.php on line 66
     
     
    Sean
     
     
     
    On Wednesday, April 17, 2013 5:07:25 AM UTC-6, Jose Alcérreca (AdSense API
    Team) wrote:

     

    "Jose Alcérreca (AdSense API Team)" <adsenseapiadvisor+jose@google.com> Apr 17 10:00AM -0700  

    Hi,

    Do an adclient.list<https://developers.google.com/adsense/host/v4.1/adclients/list>to the publisher and get the ad client id from there. You're using a wrong
    ad client id, the host's. You should get the publisher's ad client id.
     
    Cheers,
    Jose
     
    ---
    Jose Alcérreca
    Developer Relations
     
    Google UK Limited
    Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W
    9TQ
    Registered in England Number: 3977902
     
     
    Google Inc.| Developer Relations | *AdSense API Team* |
    developers.google.com/**adsense <https://developers.google.com/adsense/>
     
    On Wednesday, 17 April 2013 17:45:08 UTC+1, Sean wrote:

     

    Sean <neolocutus@gmail.com> Apr 17 11:23AM -0700  

    From this page:
    https://developers.google.com/adsense/host/v4.1/accounts/adunits/insert
     
    Using accountID = pub-257160407xxxxxx and adClientID =
    ca-pub-257160407xxxxxx (is that the two IDs I'm supposed to be using?)
     
    Using this AdUnit
     
    {
    "code": "asfd asdf asf dsadf ",
    "contentAdsSettings": {
    "backupOption": {
    "color": "GREEN",
    "type": "COLOR"
    },
    "size": "SIZE_160_600",
    "type": "TEXT"
    },
    "customStyle": {
    "colors": {
    "background": "BLUE",
    "border": "GREEN",
    "text": "YELLOW",
    "title": "PURPLE",
    "url": "BLACK"
    },
    "corners": "SQUARE",
    "font": {
    "family": "TIMES",
    "size": "MEDIUM"
    },
    "kind": "adsensehost#adStyle"
    },
    "id": "as fdasdf sa d",
    "kind": "adsensehost#adUnit",
    "name": "adfasfa ",
    "status": "ACTIVE",
    "mobileContentAdsSettings": {
    "markupLanguage": "PHP",
    "scriptingLanguage": "PHP",
    "size": "SIZE_160_600",
    "type": "TEXT"
    }
     
    }
     
     
    I get a backendError message.
     
     
    503 Service Unavailable
     
    - Show headers -

    {
    "error": {
    "errors": [
    {
    "domain": "global",
    "reason": "backendError",
    "message": "Backend Error"
    }
    ],
    "code": 503,
    "message": "Backend Error"
    }
    }
     
     
     
     
    On Wednesday, April 17, 2013 11:00:42 AM UTC-6, Jose Alcérreca (AdSense API
    Team) wrote:

     

    Sean <neolocutus@gmail.com> Apr 17 10:35AM -0700  

    using the api explorer tool, plugging in the pubID (pub-25716040709XXXXXX),
    I get this:
     
    So which ID do I use from this? The ca-pub-257 one as the ad client ID?
     
    {
    "kind": "adsensehost#adClients",
    "etag": "\"EUUHVDxYtoc5avjf_IY_33wbZnE/WyxxxxxxVGV_ag05B4nAA\"",
    "items": [
    {
    "kind": "adsensehost#adClient",
    "id": "ca-pub-25716040709XXXXXX",
    "productCode": "AFC",
    "supportsReporting": true
    }
    ]
    }
     
    Sean
     
    On Wednesday, April 17, 2013 11:00:42 AM UTC-6, Jose Alcérreca (AdSense API
    Team) wrote:

     

You received this message because you are subscribed to the Google Group adsense-api.
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.

--
You received this message because you are subscribed to the Google Groups "AdSense API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adsense-api+unsubscribe@googlegroups.com.
To post to this group, send email to adsense-api@googlegroups.com.
Visit this group at http://groups.google.com/group/adsense-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment