How do I find the adgroup ID?

6,481 views
Skip to first unread message

Nicholas Hibberd

unread,
Nov 5, 2010, 1:52:50 PM11/5/10
to AdWords API Forum
Hi,

Quick question.

I've just got going with the Adwords API, and have been trying to
upload a test ad to one of our adgroups.

I took what I took to be the adgroup id from the url string when
browsing to the adgroup in question, but this did not work, and I
couldn't think how else to find an adgroup id?

SOAP Error: [EntityNotFound.INVALID_ID @
operations[0].operand.adGroupId; trigger:'AdGroupId:
55731815324317463']

Cheers

AdWords API Advisor

unread,
Nov 9, 2010, 10:59:28 AM11/9/10
to AdWords API Forum
Hi Nicholas,

There is no supported way to get an ad group ID from the Adwords web
interface. You'll need to request all ad groups in the campaign and
choose the one with the same name.

Best,
- Eric Koleda, AdWords API Team

Nicholas Hibberd

unread,
Nov 23, 2010, 6:06:30 AM11/23/10
to AdWords API Forum
Hi, thanks for your reply, sorry I didn't see this for a while

If there are no ad group ids, what do I stick in the
'INSERT_AD_GROUP_ID_HERE' section in the below code?

This is from:

http://code.google.com/p/google-api-adwords-ruby/source/browse/branches/v19.1.0/examples/v201003/add_ads.rb?spec=svn59&r=59


def add_ads()
# AdWords::AdWordsCredentials.new will read a credentials file from
# ENV['HOME']/adwords.properties when called without parameters.
adwords = AdWords::API.new
ad_group_ad_srv = adwords.get_service('AdGroupAd', API_VERSION)

ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
video_media_id = 'INSERT_VIDEO_MEDIA_ID_HERE'.to_i

# Create text ad.
# The 'module' method being called here provides a shortcut to the
# module containing the classes for this service. This helps us
avoid
# typing the full class name every time we need to create an object.
text_ad = ad_group_ad_srv.module::TextAd.new
text_ad.headline = 'Luxury Cruise to Mars'
text_ad.description1 = 'Visit the Red Planet in style.'
text_ad.description2 = 'Low-gravity fun for everyone!'
text_ad.url = 'http://www.example.com'
text_ad.displayUrl = 'www.example.com'
text_ad_operation = ad_group_ad_srv.module::AdGroupAdOperation.new
text_ad_operation.operand = {
:adGroupId => ad_group_id,
:ad => text_ad
}
text_ad_operation.operator = 'ADD'


Cheers

Nick

On Nov 9, 3:59 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> Hi Nicholas,
>
> There is no supported way to get an ad groupIDfrom the Adwords web
> interface.  You'll need to request all ad groups in the campaign and
> choose the one with the same name.
>
> Best,
> - Eric Koleda, AdWords API Team
>
> On Nov 5, 12:52 pm, Nicholas Hibberd <ni...@yourgolftravel.com> wrote:
>
> > Hi,
>
> > Quick question.
>
> > I've just got going with the Adwords API, and have been trying to
> > upload a test ad to one of our adgroups.
>
> > I took what I took to be theadgroupidfrom the url string when
> > browsing to theadgroupin question, but this did not work, and I

AdWords API Advisor

unread,
Nov 29, 2010, 11:46:40 AM11/29/10
to AdWords API Forum
Hi Nick,

You can use the AdGroupService to fetch the ids of existing ad groups
or add new ad groups.

Best,
- Eric

On Nov 23, 6:06 am, Nicholas Hibberd <ni...@yourgolftravel.com> wrote:
> Hi, thanks for your reply, sorry I didn't see this for a while
>
> If there are no ad group ids, what do I stick in the
> 'INSERT_AD_GROUP_ID_HERE' section in the below code?
>
> This is from:
>
> http://code.google.com/p/google-api-adwords-ruby/source/browse/branch...
Reply all
Reply to author
Forward
0 new messages