← back to Gmc Titlefix
diag2.js
13 lines
const {token,MERCHANT}=require('./_auth');
const offerId=require('fs').readFileSync('/tmp/gmc-titlefix-canary-offer.txt','utf8').trim();
(async()=>{
const tok=await token(); const H={Authorization:'Bearer '+tok};
const id=`online:en:US:${offerId}`;
const r=await fetch(`https://shoppingcontent.googleapis.com/content/v2.1/${MERCHANT}/products/${encodeURIComponent(id)}`,{headers:H});
const j=await r.json();
console.log('offerId:',offerId);
console.log('title :',j.title);
console.log('source :',j.source); // 'api' vs 'feed:...' etc
console.log('channel:',j.channel,'| feedLabel:',j.feedLabel,'| contentLanguage:',j.contentLanguage);
})().catch(e=>console.error('ERR',e.message));