Multiple channels per getAdCode request?

21 views
Skip to first unread message

Sean

unread,
Apr 25, 2013, 2:16:36 PM4/25/13
to adsen...@googlegroups.com
How can I include more then one channel ID in the getAdCode request?

When I include more then one with either a , or a url encoded , as a separator, I get an "Custom Ad Channel Not Found" error.

If I am supposed to use something other then a , to include more then one ad channel, how would I go about doing that.

Thanks,

Sean

Sérgio Gomes (AdSense API Team)

unread,
Apr 26, 2013, 8:36:36 AM4/26/13
to adsen...@googlegroups.com
Hi Sean,

The way this is done in all Google RESTful APIs is by specifying the parameter multiple times. In your example, that would be something along the lines of:

hostCustomChannelId=<first ID>&hostCustomChannelId=<second ID>&hostCustomChannelId=<third ID>

Hope this helps!

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

Sérgio Gomes (AdSense API Team)

unread,
Apr 26, 2013, 9:12:11 AM4/26/13
to adsen...@googlegroups.com
By the way, I forgot to mention, if you're using a client library, they usually take care of this to you :) Just assign the array to that property, and it will do the right thing.

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


Sean

unread,
Apr 26, 2013, 1:29:41 PM4/26/13
to adsen...@googlegroups.com
Thanks, this worked.

    $optt = array();
    $optt['hostCustomChannelId'] = array();
   
    $optt['hostCustomChannelId'][] = $adch;
   
    if ($uc != '') {
        $optt['hostCustomChannelId'][] = $uc;
    }
       
    $adzz = $adsensehostService->accounts_adunits->getAdCode($pubID, $adClientID, $adUnitID, $optt);


Sean
Reply all
Reply to author
Forward
0 new messages