How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/content.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const content = google.content('v2.1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/content'],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await content.products.update({
        // The ID of the account that contains the product. This account cannot be a multi-client account.
        merchantId: 'placeholder-value',
        // The REST ID of the product for which to update.
        productId: 'placeholder-value',
        // The comma-separated list of product attributes to be updated. Example: `"title,salePrice"`. Attributes specified in the update mask without a value specified in the body will be deleted from the product. Only top-level product attributes can be updated. If not defined, product attributes with set values will be updated and other attributes will stay unchanged.
        updateMask: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "additionalImageLinks": [],
          //   "additionalSizeType": "my_additionalSizeType",
          //   "adsGrouping": "my_adsGrouping",
          //   "adsLabels": [],
          //   "adsRedirect": "my_adsRedirect",
          //   "adult": false,
          //   "ageGroup": "my_ageGroup",
          //   "availability": "my_availability",
          //   "availabilityDate": "my_availabilityDate",
          //   "brand": "my_brand",
          //   "canonicalLink": "my_canonicalLink",
          //   "channel": "my_channel",
          //   "color": "my_color",
          //   "condition": "my_condition",
          //   "contentLanguage": "my_contentLanguage",
          //   "costOfGoodsSold": {},
          //   "customAttributes": [],
          //   "customLabel0": "my_customLabel0",
          //   "customLabel1": "my_customLabel1",
          //   "customLabel2": "my_customLabel2",
          //   "customLabel3": "my_customLabel3",
          //   "customLabel4": "my_customLabel4",
          //   "description": "my_description",
          //   "displayAdsId": "my_displayAdsId",
          //   "displayAdsLink": "my_displayAdsLink",
          //   "displayAdsSimilarIds": [],
          //   "displayAdsTitle": "my_displayAdsTitle",
          //   "displayAdsValue": {},
          //   "energyEfficiencyClass": "my_energyEfficiencyClass",
          //   "excludedDestinations": [],
          //   "expirationDate": "my_expirationDate",
          //   "gender": "my_gender",
          //   "googleProductCategory": "my_googleProductCategory",
          //   "gtin": "my_gtin",
          //   "id": "my_id",
          //   "identifierExists": false,
          //   "imageLink": "my_imageLink",
          //   "includedDestinations": [],
          //   "installment": {},
          //   "isBundle": false,
          //   "itemGroupId": "my_itemGroupId",
          //   "kind": "my_kind",
          //   "link": "my_link",
          //   "linkTemplate": "my_linkTemplate",
          //   "loyaltyPoints": {},
          //   "material": "my_material",
          //   "maxEnergyEfficiencyClass": "my_maxEnergyEfficiencyClass",
          //   "maxHandlingTime": "my_maxHandlingTime",
          //   "minEnergyEfficiencyClass": "my_minEnergyEfficiencyClass",
          //   "minHandlingTime": "my_minHandlingTime",
          //   "mobileLink": "my_mobileLink",
          //   "mobileLinkTemplate": "my_mobileLinkTemplate",
          //   "mpn": "my_mpn",
          //   "multipack": "my_multipack",
          //   "offerId": "my_offerId",
          //   "pattern": "my_pattern",
          //   "pickupMethod": "my_pickupMethod",
          //   "pickupSla": "my_pickupSla",
          //   "price": {},
          //   "productDetails": [],
          //   "productHeight": {},
          //   "productHighlights": [],
          //   "productLength": {},
          //   "productTypes": [],
          //   "productWeight": {},
          //   "productWidth": {},
          //   "promotionIds": [],
          //   "salePrice": {},
          //   "salePriceEffectiveDate": "my_salePriceEffectiveDate",
          //   "sellOnGoogleQuantity": "my_sellOnGoogleQuantity",
          //   "shipping": [],
          //   "shippingHeight": {},
          //   "shippingLabel": "my_shippingLabel",
          //   "shippingLength": {},
          //   "shippingWeight": {},
          //   "shippingWidth": {},
          //   "shoppingAdsExcludedCountries": [],
          //   "sizeSystem": "my_sizeSystem",
          //   "sizeType": "my_sizeType",
          //   "sizes": [],
          //   "source": "my_source",
          //   "subscriptionCost": {},
          //   "targetCountry": "my_targetCountry",
          //   "taxCategory": "my_taxCategory",
          //   "taxes": [],
          //   "title": "my_title",
          //   "transitTimeLabel": "my_transitTimeLabel",
          //   "unitPricingBaseMeasure": {},
          //   "unitPricingMeasure": {}
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "additionalImageLinks": [],
      //   "additionalSizeType": "my_additionalSizeType",
      //   "adsGrouping": "my_adsGrouping",
      //   "adsLabels": [],
      //   "adsRedirect": "my_adsRedirect",
      //   "adult": false,
      //   "ageGroup": "my_ageGroup",
      //   "availability": "my_availability",
      //   "availabilityDate": "my_availabilityDate",
      //   "brand": "my_brand",
      //   "canonicalLink": "my_canonicalLink",
      //   "channel": "my_channel",
      //   "color": "my_color",
      //   "condition": "my_condition",
      //   "contentLanguage": "my_contentLanguage",
      //   "costOfGoodsSold": {},
      //   "customAttributes": [],
      //   "customLabel0": "my_customLabel0",
      //   "customLabel1": "my_customLabel1",
      //   "customLabel2": "my_customLabel2",
      //   "customLabel3": "my_customLabel3",
      //   "customLabel4": "my_customLabel4",
      //   "description": "my_description",
      //   "displayAdsId": "my_displayAdsId",
      //   "displayAdsLink": "my_displayAdsLink",
      //   "displayAdsSimilarIds": [],
      //   "displayAdsTitle": "my_displayAdsTitle",
      //   "displayAdsValue": {},
      //   "energyEfficiencyClass": "my_energyEfficiencyClass",
      //   "excludedDestinations": [],
      //   "expirationDate": "my_expirationDate",
      //   "gender": "my_gender",
      //   "googleProductCategory": "my_googleProductCategory",
      //   "gtin": "my_gtin",
      //   "id": "my_id",
      //   "identifierExists": false,
      //   "imageLink": "my_imageLink",
      //   "includedDestinations": [],
      //   "installment": {},
      //   "isBundle": false,
      //   "itemGroupId": "my_itemGroupId",
      //   "kind": "my_kind",
      //   "link": "my_link",
      //   "linkTemplate": "my_linkTemplate",
      //   "loyaltyPoints": {},
      //   "material": "my_material",
      //   "maxEnergyEfficiencyClass": "my_maxEnergyEfficiencyClass",
      //   "maxHandlingTime": "my_maxHandlingTime",
      //   "minEnergyEfficiencyClass": "my_minEnergyEfficiencyClass",
      //   "minHandlingTime": "my_minHandlingTime",
      //   "mobileLink": "my_mobileLink",
      //   "mobileLinkTemplate": "my_mobileLinkTemplate",
      //   "mpn": "my_mpn",
      //   "multipack": "my_multipack",
      //   "offerId": "my_offerId",
      //   "pattern": "my_pattern",
      //   "pickupMethod": "my_pickupMethod",
      //   "pickupSla": "my_pickupSla",
      //   "price": {},
      //   "productDetails": [],
      //   "productHeight": {},
      //   "productHighlights": [],
      //   "productLength": {},
      //   "productTypes": [],
      //   "productWeight": {},
      //   "productWidth": {},
      //   "promotionIds": [],
      //   "salePrice": {},
      //   "salePriceEffectiveDate": "my_salePriceEffectiveDate",
      //   "sellOnGoogleQuantity": "my_sellOnGoogleQuantity",
      //   "shipping": [],
      //   "shippingHeight": {},
      //   "shippingLabel": "my_shippingLabel",
      //   "shippingLength": {},
      //   "shippingWeight": {},
      //   "shippingWidth": {},
      //   "shoppingAdsExcludedCountries": [],
      //   "sizeSystem": "my_sizeSystem",
      //   "sizeType": "my_sizeType",
      //   "sizes": [],
      //   "source": "my_source",
      //   "subscriptionCost": {},
      //   "targetCountry": "my_targetCountry",
      //   "taxCategory": "my_taxCategory",
      //   "taxes": [],
      //   "title": "my_title",
      //   "transitTimeLabel": "my_transitTimeLabel",
      //   "unitPricingBaseMeasure": {},
      //   "unitPricingMeasure": {}
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/content.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const content = google.content('v2.1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/content'],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await content.localinventory.insert({
        // The ID of the account that contains the product. This account cannot be a multi-client account.
        merchantId: 'placeholder-value',
        // The REST ID of the product for which to update local inventory.
        productId: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "availability": "my_availability",
          //   "instoreProductLocation": "my_instoreProductLocation",
          //   "kind": "my_kind",
          //   "pickupMethod": "my_pickupMethod",
          //   "pickupSla": "my_pickupSla",
          //   "price": {},
          //   "quantity": 0,
          //   "salePrice": {},
          //   "salePriceEffectiveDate": "my_salePriceEffectiveDate",
          //   "storeCode": "my_storeCode"
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "availability": "my_availability",
      //   "instoreProductLocation": "my_instoreProductLocation",
      //   "kind": "my_kind",
      //   "pickupMethod": "my_pickupMethod",
      //   "pickupSla": "my_pickupSla",
      //   "price": {},
      //   "quantity": 0,
      //   "salePrice": {},
      //   "salePriceEffectiveDate": "my_salePriceEffectiveDate",
      //   "storeCode": "my_storeCode"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/content.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const content = google.content('v2.1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/content'],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await content.products.list({
        // The maximum number of products to return in the response, used for paging.
        maxResults: 'placeholder-value',
        // The ID of the account that contains the products. This account cannot be a multi-client account.
        merchantId: 'placeholder-value',
        // The token returned by the previous request.
        pageToken: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "kind": "my_kind",
      //   "nextPageToken": "my_nextPageToken",
      //   "resources": []
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/content.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const content = google.content('v2.1');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/content'],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await content.products.delete({
        // The Content API Supplemental Feed ID. If present then product deletion applies to the data in a supplemental feed. If absent, entire product will be deleted.
        feedId: 'placeholder-value',
        // The ID of the account that contains the product. This account cannot be a multi-client account.
        merchantId: 'placeholder-value',
        // The REST ID of the product.
        productId: 'placeholder-value',
      });
      console.log(res.data);
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • // Before running the sample:
    // - Enable the API at:
    //   https://console.developers.google.com/apis/api/content.googleapis.com
    // - Login into gcloud by running:
    //   `$ gcloud auth application-default login`
    // - Install the npm module by running:
    //   `$ npm install googleapis`
    
    const {google} = require('googleapis');
    const content = google.content('v2');
    
    async function main() {
      const auth = new google.auth.GoogleAuth({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/content'],
      });
    
      // Acquire an auth client, and bind it to all future calls
      const authClient = await auth.getClient();
      google.options({auth: authClient});
    
      // Do the magic
      const res = await content.inventory.set({
        // Flag to simulate a request like in a live environment. If set to true, dry-run mode checks the validity of the request and returns errors (if any).
        dryRun: 'placeholder-value',
        // The ID of the account that contains the product. This account cannot be a multi-client account.
        merchantId: 'placeholder-value',
        // The REST ID of the product for which to update price and availability.
        productId: 'placeholder-value',
        // The code of the store for which to update price and availability. Use `online` to update price and availability of an online product.
        storeCode: 'placeholder-value',
    
        // Request body metadata
        requestBody: {
          // request body parameters
          // {
          //   "availability": "my_availability",
          //   "customLabel0": "my_customLabel0",
          //   "customLabel1": "my_customLabel1",
          //   "customLabel2": "my_customLabel2",
          //   "customLabel3": "my_customLabel3",
          //   "customLabel4": "my_customLabel4",
          //   "installment": {},
          //   "instoreProductLocation": "my_instoreProductLocation",
          //   "loyaltyPoints": {},
          //   "pickup": {},
          //   "price": {},
          //   "quantity": 0,
          //   "salePrice": {},
          //   "salePriceEffectiveDate": "my_salePriceEffectiveDate",
          //   "sellOnGoogleQuantity": 0
          // }
        },
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "kind": "my_kind"
      // }
    }
    
    main().catch(e => {
      console.error(e);
      throw e;
    });
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples