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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to