Extract targeting presets

31 views
Skip to first unread message

mc12...@yandex.ru

unread,
Jul 1, 2015, 2:10:39 PM7/1/15
to adwor...@googlegroups.com
Hi,
Is it possible fetch all my targeting presets with you API ?

Anthony Madrigal

unread,
Jul 1, 2015, 3:16:13 PM7/1/15
to adwor...@googlegroups.com, mc12...@yandex.ru
Hi,

Yes, you can retrieve your targets by using the CampaignCriterionService. 

This example demonstrates how to retrieve target locations. If you want to include all targets, then you will need to remove the line that sets the CriteriaType.

Cheers,
Anthony
AdWords API Team

mc12...@yandex.ru

unread,
Jul 3, 2015, 5:44:09 AM7/3/15
to adwor...@googlegroups.com
Many thanks for you response.

But when i trying to fetch targeting as in you example, i get a `Credential could not be refreshed. (OfflineCredentials.java:149)` error.

I use the next code sample for scala:

val cId = "cliendId"
val cs = "clientSecret"
val r = "refreshToken"

val oAuth2Credential = new OfflineCredentials.Builder()
.forApi(Api.ADWORDS)
.withClientSecrets(cId, cs).withRefreshToken(r)
.build()
.generateCredential()

val session = new AdWordsSession.Builder()
.fromFile()
.withOAuth2Credential(oAuth2Credential)
.build()

val adWordsServices = new AdWordsServices()

val campaignCriterionService = adWordsServices.get(session, classOf[CampaignCriterionServiceInterface])

mc12...@yandex.ru

unread,
Jul 6, 2015, 8:41:44 AM7/6/15
to adwor...@googlegroups.com
Hi, 

Is it possible extract targeting inly with DFP api (without AdWords) ?

Anthony Madrigal

unread,
Jul 6, 2015, 1:11:09 PM7/6/15
to adwor...@googlegroups.com, mc12...@yandex.ru
Hi,

Your variables cId, cs, and r do not have the correct values in them. You will need to use the values from the ads.properties file or replace .withClientSecrets(cId, cs).withRefreshToken(r) with fromFile().

The DFP API forum will have a better idea of whether you can extract targeting using DFP API, so I suggest posting the question on their forum

Regards,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages