Hi everyone!
During the last few weeks we had some issues (=> problems) with generating our data feed thanks to which the amount of active products for the account went rapidly down. As a result, there was a massive breakdown of our dynamic ads that were using data from the feed. For my team this is an unwanted event (which we can't affect), therefore I wanted to make an auto-checker script using the awesome Google Apps Script and the Google Content API for Shopping.
I managed to progress on the script, but got into troubles and I'm not finding any hints how to move forward. The problem I am solving is getting the number of active items in my account. For this, I am using the ShoppingContent.Products.list request function, which (in default way) returns only 25 products, and the parameter of nextPageToken (I understand the importance of paging). Therefore I put the whole stuff into a loop and in every next iteration of the loop I send the nextPageToken parameter as custom parameter to the list() function.
However, the loop couldn't be stopped, because after receiving all of the products I start to receive them over and over again. I don't know, which conditions are met, when I managed to receive all of the active products (and nowhere found information about that).
For example, if there would be 75 active items in my merchant account and receiving 20 products per loop, I would expect the loop to be completed 4 times, and in the possible 5th iteration it would receive 0 products, so I could stop the loop and would come to conclusion there are totally 75 active items in my account. Unfortunately I can't, because the loop don't stop.
Any ideas how to get the number of active items in my account using the Content API for shopping? Thanks in advance for any advices!
With best regards,
Tomas Bako from Zgruntu Online