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.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.insert({
        // The Content API Supplemental Feed ID. If present then product insertion applies to the data in a supplemental feed.
        feedId: 'placeholder-value',
        // The ID of the account that contains the product. This account cannot be a multi-client account.
        merchantId: '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.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/vision.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 vision = google.vision('v1');
    
    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/cloud-platform',
          'https://www.googleapis.com/auth/cloud-vision',
        ],
      });
    
      // 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 vision.projects.locations.productSets.products.list({
        // Required. The ProductSet resource for which to retrieve Products. Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
        name: 'projects/my-project/locations/my-location/productSets/my-productSet',
        // The maximum number of items to return. Default 10, maximum 100.
        pageSize: 'placeholder-value',
        // The next_page_token returned from a previous List request, if any.
        pageToken: 'placeholder-value',
      });
      console.log(res.data);
    
      // Example response
      // {
      //   "nextPageToken": "my_nextPageToken",
      //   "products": []
      // }
    }
    
    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