Hi Anash, maybe I was not clear, how do you access the sitelink (and then consequently the getLinkUrl method)? Outside the google script environment I don't have access to an object called AdwordsApp, as I showed in my code I can only access the AdwordsServices class and then use one of the ServiceInterface interfaces, as showed also on many examples around, also from the adwords team on github. Using the FeedServiceInterface doesn't return what I actually want. Am I missing something obvious?
For completeness, this are the dependencies I imported using SBT: "com.google.http-client" % "google-http-client-jackson2" % "1.18.0-rc", "com.google.api-ads" % "ads-lib" % "1.27.0", "com.google.api-ads" % "adwords-axis" % "1.27.0" On Friday, 11 July 2014 06:11:09 UTC+2, Anash P. Oommen (AdWords API Team) wrote: > > Hi, > > You can use the getLinkUrl method of sitelink. See > https://developers.google.com/adwords/scripts/docs/reference/adwordsapp/adwordsapp_sitelink > > for details. Scripts has a simplified version of FeedServiceInterface, so > you need to rely mostly on the scripts documentation than the API > documentation for this feature. > > Cheers, > Anash P. Oommen, > AdWords Scripts Team. > > On Tuesday, June 24, 2014 4:18:18 AM UTC-4, Emiliano Busiello wrote: >> >> I'm trying to get url out of sitelinks, I looked at this piece of code: >> >> var campaigns = AdWordsApp.campaigns() >> .withCondition("LabelNames CONTAINS_NONE['" + >> settings.sitelinksLabel + >> "']") >> .get(); >> while (campaigns.hasNext()) { >> var campaign = campaigns.next(); >> var sitelinks = campaign.extensions().sitelinks().get(); >> >> Logger.log('Checking %s sitelinks.', sitelinks.totalNumEntities()); >> while (sitelinks.hasNext()) { >> var sitelink = sitelinks.next(); >> var status = getUrlStatus(sitelink.getLinkUrl()); >> accountSheet.appendRow(['', sitelink.getLinkUrl(), >> status, campaign.getName(), >> '', '', '', sitelink.getLinkText()]); >> } >> campaign.applyLabel(settings.sitelinksLabel); >> } >> >> >> Taken from here >> <https://developers.google.com/adwords/scripts/docs/solutions/link-checker#mccapp>, >> >> I also had a look around at the API documentation and at this >> <https://developers.google.com/adwords/api/docs/guides/feed-services> >> example >> (which unfortunately doesn't treat get operations) and as far as I >> understand the FeedServiceInterface is what I should use. This is my code >> at the moment: >> >> val adWordsServices = new AdWordsServices() >> var offset = 0 >> var limit = 100 >> >> val service = adWordsServices.get(connection, >> classOf[FeedServiceInterface]) >> >> val builder = new SelectorBuilder() >> var selector = builder >> .fields("Name", "Attributes") >> .offset(offset) >> .limit(limit) >> .build() >> >> var page = service.get(selector) >> >> if (page.getEntries() != null) { >> var campaigns: List[Feed] = page.getEntries().toList >> >> campaigns.foreach(x => { >> >> val t: Array[FeedAttribute] = x.getAttributes >> >> t.foreach(x => { >> println(x.getId) >> println(x.getName) >> println(x.getType.getValue) >> }) >> }) >> } >> >> First, this doesn't retun the urls (eg there's no getUrl or getValue or >> something similar), second, how do you know how to build your selector? >> More specifically, which fields I can query for? I searched for hours >> without finding anything, I got attributes right only by chance. >> > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.