← back to Gmc Titlefix

diag3.js

15 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};
  // Merchant API processed product: name=accounts/{a}/products/{channel~contentLang~feedLabel~offerId}
  const name=`accounts/${MERCHANT}/products/online~en~US~${offerId}`;
  const r=await fetch(`https://merchantapi.googleapis.com/products/v1/${name}`,{headers:H});
  const j=await r.json();
  console.log('HTTP',r.status);
  console.log('name        :',j.name);
  console.log('dataSource  :',j.dataSource,'  <-- owning PRIMARY');
  console.log('title (eff) :',j.attributes&&j.attributes.title);
  console.log('versionNumber:',j.versionNumber);
})().catch(e=>console.error('ERR',e.message));