Sitelink Feed Services - Retrieve Existing Feeds

47 views
Skip to first unread message

AL

unread,
Jan 16, 2017, 3:13:21 AM1/16/17
to AdWords API Forum
Hi,

I am trying to check if a feed exists on the account and if not then create it. I'm having trouble however with the getting of existing feed.

I want to get the feed based on a specific feed name ('Sitelinks Feed').

If the feed doesn't exist, then I want to create it with that name.

I'm using Python and API v201609.

Joyce Lava

unread,
Jan 16, 2017, 3:36:56 AM1/16/17
to AdWords API Forum
Hello,

You may refer to the below sample SOAP logs that shows how to check if a feed already exist using its name as the filter:

[main] INFO com.google.api.ads.adwords.lib.client.AdWordsServiceClient.soapXmlLogger - SOAP Request:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201609" soapenv:mustUnderstand="0">
            <ns1:clientCustomerId>YOUR_CLIENT_CUSTOMER_ID</ns1:clientCustomerId>
            <ns1:developerToken>YOUR_DEVELOPER_TOKEN</ns1:developerToken>
            <ns1:userAgent>YOUR_USER_AGENT</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
        <get xmlns="https://adwords.google.com/api/adwords/cm/v201609">
            <selector>
                <fields>Attributes</fields>
                <fields>Name</fields>
                <fields>Id</fields>
                <predicates>
                    <field>Name</field>
                    <operator>EQUALS</operator>
                    <values>NAME_OF_THE_FEED</values>
                </predicates>
                <ordering>
                    <field>Name</field>
                    <sortOrder>ASCENDING</sortOrder>
                </ordering>
                <paging>
                    <startIndex>0</startIndex>
                    <numberResults>100</numberResults>
                </paging>
            </selector>
        </get>
    </soapenv:Body>
</soapenv:Envelope>

[main] INFO com.google.api.ads.adwords.lib.client.AdWordsServiceClient.soapXmlLogger - SOAP Response:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201609">
            <requestId>REQUEST_ID</requestId>
            <serviceName>FeedService</serviceName>
            <methodName>get</methodName>
            <operations>1</operations>
            <responseTime>280</responseTime>
        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201609">
            <rval>
                <totalNumEntries>1</totalNumEntries>
                <Page.Type>FeedPage</Page.Type>
                <entries>
                    <id>ID</id>
                    <name>NAME_OF_THE_FEED</name>
                    <attributes>
                      ...feed attributes listed here...
                    </attributes>
                </entries>
            </rval>
        </getResponse>
    </soap:Body>
</soap:Envelope>

Additionally, if the feed doesn't exist yet, then you may refer to the sample code AddSitelinksUsingFeed.php that shows how to create a sitelinks feed and associates it with a campaign.

Hope this helps.

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