Friday, May 4, 2012

Digest for adsense-api@googlegroups.com - 4 Messages in 2 Topics

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

    Brian Deyo <chachawebstats@gmail.com> May 03 08:09AM -0700  

    I have a simple api call to pull earnings by product_name. On the web site
    I can see 4 products: Adsense for Content, Adsense for Search, adsense for
    Mobile content, and adsense for mobile application (search). The api
    however, only returns: Adsense for content, and adsense for mobile content.
     
    What could I be doing wrong?

     

    Roel <roel.duijnhoven@gmail.com> May 02 05:29PM -0700  

    Hello,
     
    For a while I have been struggling now to get a script to communicate with
    a AdSense account that I own via the AdSense API.
     
    As this is thus one single AdSense account that I own myself I decided to
    choose the service account authentication technique using a certificate (
    https://developers.google.com/accounts/docs/OAuth2#serviceaccount). A
    snipplet of the PHP code is given by:
     
    $client = new apiClient();

    $key = file_get_contents(KEY_FILE);
    $client->setClientId(CLIENT_ID);
    $client->setAssertionCredentials(new apiAssertionCredentials(
    SERVICE_ACCOUNT_NAME,
    array('https://www.googleapis.com/auth/adsense.readonly'),
    $key)
    );

    $service = new apiAdsenseService($client);
    $results = $service->reports->generate('2012-04-01', '2012-04-31');
     
    I enabled the Adsense Management API, but still when I now run this script
    I get a response of:
     
    (403) User does not have an AdSense account
     
     
    The account using which I have created the OAuth keys is the very same
    account having access to the AdSense page. Thus the same e-mail address
    appers in the top-right corner.
     
    What could I be doing wrong?
     
    Best,
    Roel

     

    "Sérgio Gomes" <sergio.gomes@google.com> May 03 07:44AM -0700  

    Hi Roel,
     
    I'm afraid that accessing the AdSense Management API via service account
    authentication is not supported, since it's protected user information (and
    as described in the service account authentication entry in the
    documentation page you linked to, access to user information is not
    supported).
     
    This doesn't mean that support couldn't be added in the future, but for now
    you'll need to stick to web-based or installed authentication for PHP.
     
    Cheers,
    Sérgio
     
    ---
    Sérgio Gomes
    Developer Relations
     
    Google UK Limited
    Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W
    9TQ
    Registered in England Number: 3977902
     
    ----
    On Thursday, 3 May 2012 01:29:20 UTC+1, Roel wrote:

     

    "Eric Haskins" <eric@voodoo.com> May 03 10:38AM -0400  

    Service Accounts wont work when a User is required like in the case of
    AdSense. You will need to use oAuth. Even though you have a private key etc
     
     

     
    Eric Haskins
     

     
    From: adsense-api@googlegroups.com [mailto:adsense-api@googlegroups.com] On
    Behalf Of Roel
    Sent: Wednesday, May 02, 2012 8:29 PM
    To: adsense-api@googlegroups.com
    Subject: (403) User does not have an AdSense account
     

     
    Hello,
     
    For a while I have been struggling now to get a script to communicate with a
    AdSense account that I own via the AdSense API.
     
    As this is thus one single AdSense account that I own myself I decided to
    choose the service account authentication technique using a certificate
    (https://developers.google.com/accounts/docs/OAuth2#serviceaccount). A
    snipplet of the PHP code is given by:
     
    $client = new apiClient();

    $key = file_get_contents(KEY_FILE);
    $client->setClientId(CLIENT_ID);
    $client->setAssertionCredentials(new apiAssertionCredentials(
    SERVICE_ACCOUNT_NAME,
    array('https://www.googleapis.com/auth/adsense.readonly'),
    $key)
    );

    $service = new apiAdsenseService($client);
    $results = $service->reports->generate('2012-04-01', '2012-04-31');
     
    I enabled the Adsense Management API, but still when I now run this script I
    get a response of:
     
    (403) User does not have an AdSense account
     
     
    The account using which I have created the OAuth keys is the very same
    account having access to the AdSense page. Thus the same e-mail address
    appers in the top-right corner.
     
    What could I be doing wrong?
     
    Best,
    Roel
     
    --
    You received this message because you are subscribed to the Google Groups
    "AdSense API Forum" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/adsense-api/-/lqBmSu4ax7YJ.
    To post to this group, send email to adsense-api@googlegroups.com.
    To unsubscribe from this group, send email to
    adsense-api+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/adsense-api?hl=en.

     

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 post to this group, send email to adsense-api@googlegroups.com.
To unsubscribe from this group, send email to adsense-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/adsense-api?hl=en.

No comments:

Post a Comment