Steps to enable Content API for Shopping?

1,128 views
Skip to first unread message

Roy Steves

unread,
Apr 27, 2016, 3:44:27 PM4/27/16
to AdWords Scripts Forum
I'm trying to enable the Content API for Shopping on either my MCC, or, failing that, at least for my individual client Accounts.

The AdWords Scripts navigation kicks me over to the Content API for Shopping documentation, and pages like this reference that it "must be enabled before use".

Clicking the "enabled before use" takes me to: https://developers.google.com/apps-script/guides/services/advanced

Which gives me steps to enable advanced services, starting with "In the script editor, select Resources > Advanced Google services".  I eventually figured out that it didn't mean the Script editor in Adwords, but rather the general Scripts for Apps editor.  As an Adwords user, I'd never seen this editor before, but I followed the instructions.  I found the Content API for Shopping, and clicked the link to Google Developers Console to enable it from that side, as well.  

I am then presented with this:

I don't know under which context I don't have permissions, whether it's under my Google Admin account, or something specific to API Manager, or Developer Console, or...

But, since I'm not presented with a lot of options, I click "OK", and can see a list of APIs, despite the error, but Content API for Shopping and AdWords API aren't in the list at all.


So, I've followed a rather convoluted trail of crumbs to what seems to be a dead end.  


How is this supposed to work?  Where did I go astray?



Tyler Sidell (AdWords Scripts Team)

unread,
Apr 27, 2016, 4:31:52 PM4/27/16
to AdWords Scripts Forum
Hi Roy,

I think you may be missing a step here.  From your Script Editor -> New Script, click on Advanced APIs (see screenshot).  Then enable Shopping Content for this particular script.  You would also need to enable this in the Google Developer Console.  Beyond this would be out of scope of this forum and thus I'd suggest reaching out to App Scripts support as well.

Thanks,
Tyler Sidell
AdWords Scripts Team

Roy Steves

unread,
Apr 27, 2016, 4:41:55 PM4/27/16
to AdWords Scripts Forum
Ah, quite right--I had created a new script first.

However, when I'm in the Developer's console, the permissions errors are still in place, and there's nothing regarding the Content API for Shopping or the AdWords API.  I did try creating a Project in the console, to see if that was the issue.  Would the App Scripts forum be the right place to ask about trouble in the Dev console, as well?

Assuming I get the permissions sorted, do you know if I'll be able to use the Advanced Services connections from the AdWords Scripts system from the MCC level, or will I be making those connections account by account?

Tyler Sidell (AdWords Scripts Team)

unread,
Apr 27, 2016, 5:13:13 PM4/27/16
to AdWords Scripts Forum
Hi Roy, 

We'd be able to help out with the script but it sounds like you haven't created that.  App Scripts would be different product support.  If you are getting these permission issues uin the Google Developer's Console, please reach out to the Google Cloud Services support team.

To answer the last question, you would be able to set this on the MCC level as well.

Thanks,
Tyler Sidell
AdWords Scripts Team

Roy Steves

unread,
Apr 27, 2016, 5:18:04 PM4/27/16
to AdWords Scripts Forum
Ah, so if App Scripts are completely independent from AdWords Scripts, is there a way to access the Content API for Shopping from the AdWords Scripts side at all, or would I be shifting focus to App Scripts--and then can App Scripts access AdWords?  

Sorry for the barrage of questions--the Google ecosystem is fairly convoluted, and quite confusing from the outside.

Tyler Sidell (AdWords Scripts Team)

unread,
Apr 28, 2016, 9:49:48 AM4/28/16
to AdWords Scripts Forum
Hi Roy,

You could use the Content API for Shopping from AdWords Scripts.  Please see our documentation on enabling the API from the Scripts side.  Here are some examples of working with Shopping Campaigns.

Thanks,
Tyler Sidell
AdWords Scripts Team

Roy Steves

unread,
May 6, 2016, 3:58:55 PM5/6/16
to AdWords Scripts Forum on behalf of Tyler Sidell (AdWords Scripts Team)
Thanks, Tyler!

I finally found the API in the developer console (despite it not being in the list), as the link was in the error in the logs, when I tried to test it with just authorization from the AdWords side, so that hurdle's cleared.  The link even included a project id, although I'm not sure where it got that...

Now, I'm still getting "User cannot access account 12345678" errors when I try to access ShoppingContent.Products and the like.  I'm almost certain this is related to mismatched accounts, as there was no point where I authenticated with the Merchant Center account.

So, I have my MCC login, from which I am writing and running the Script.  With that same login, I have a developer's console, where I've enabled the Content API for Shopping.  However, I have a separate email address for the MC account.  

Do I need to log into the dev console from the MC address?  If so, do I need to then also add that email to my MCC somehow in order to get the Script access to the MC in question?

Getting closer and closer--I appreciate your help!


Roy Steves
StatBid - AdWords Bidding and Optimization


--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to a topic in the Google Groups "AdWords Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/AHRp8-t_XuA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/227d394c-394e-4bcb-8ff5-a878924df2f2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Anthony Madrigal

unread,
May 6, 2016, 5:09:02 PM5/6/16
to AdWords Scripts Forum
Hi Roy,

Could you please provide me with your CID and the name of the script you are using via Reply privately to author? I'll take a look at your account to see what is going wrong.

Thanks,
Anthony
AdWords Scripts Team

Roy Steves

unread,
May 19, 2016, 1:44:51 PM5/19/16
to AdWords Scripts Forum
With Tyler's help, I found the solution!

So, the goal was to use an MCC Script to access the Content API for Shopping.

From my MCC login, I created this script:
function main() {
 
var merchantId = 'XXXXXXX'; //matches the Shopping Campaign
 
 
var products = ShoppingContent.Products.list(merchantId);
 
if (products.resources) {
   
for (var i = 0; i < products.resources.length; i++) {
     
Logger.log(products.resources[i]);
   
}
 
}
}

The merchantId corresponds to the Merchant Center account ID of a client account's Shopping Campaign.  

The first preview attempt will claim that "ShoppingContent" isn't defined.  Click the "Advanced APIs" button in the top of the editor, and check the "ShoppingContent" box:

Do NOT, however, click the highlighted Google Developers Console link--it's correct that you'll need to enable that, but there's a MUCH easier way to find the right setting.


Save the change, and preview the script again.  This time, it will give you an error that the API hasn't been enabled, in the logs.  The error, however, includes a full URL to exactly the page you need to enable your API connection.  Open that link in a new tab, and click the "enable" button.


Now, when you preview your script, it will give you an error that you don't have access to the Merchant Center account in question.  I believe this is because your MCC login isn't itself connected to the Merchant Center account in question.


However, Tyler pointed out that there is an MCC equivalent for Merchant Center, and you can apply for a Multi-Client Account (MCA, not to be confused with MCC).  You can do so here: https://support.google.com/merchants/answer/188487?hl=en


Once approved, it looks like you can only add accounts, not link existing ones.  All you need to do is have an admin on the account in question approve the addition, as per the Merchant Center support team:


Hi Roy,
In order to link an existing account to the MCA, please have the admin of the client account email us with the statement below. What is your client's ID number? Can you add them to this email and have them respond with the highlighted text below?
I authorize Google to link Merchant Center {FILL IN ID} to the {Multi-client account id}"
Thanks,
Michelle

Once done (which I had an admin account, so I was able to do so myself), it worked!


Now that the email address that I run my MCC from also has permissions to the Merchant Center account in question, permissions finally line up, and it appears to work as intended.


From here, I can store an array of Merchant Center Ids, loop over my client accounts, and generally perform miracles.


Thanks again to Tyler for pushing me in the right direction several times along the way!

 




Reply all
Reply to author
Forward
0 new messages