Retail API: Node.js Client

release levelnpm version

Retail client for Node.js

A comprehensive list of changes in each version may be found inthe CHANGELOG.

Read more about the client libraries for Cloud APIs, including the olderGoogle APIs Client Libraries, inClient Libraries Explained.

Table of contents:

Quickstart

Before you begin

  1. Select or create a Cloud Platform project.
  2. Enable billing for your project.
  3. Enable the Retail API API.
  4. Set up authentication so you can access theAPI from your local workstation.

Installing the client library

npm install @google-cloud/retail

Using the client library

// Imports the Google Cloud client libraryconst {CatalogServiceClient} = require('@google-cloud/retail');// TODO(developer): uncomment these variables with your information// const projectId = 'my-project'// const location = 'global'// Creates a clientconst client = newCatalogServiceClient();async function listCatalogs() {  const catalogs = await client.listCatalogs({    parent: `projects/${projectId}/locations/${location}`,  });  console.info(catalogs);}listCatalogs();

Samples

Samples are in thesamples/ directory. Each sample'sREADME.md has instructions for running its sample.

SampleSource CodeTry it
Analytics_service.export_analytics_metricssource codeOpen in Cloud Shell
Catalog_service.add_catalog_attributesource codeOpen in Cloud Shell
Catalog_service.get_attributes_configsource codeOpen in Cloud Shell
Catalog_service.get_completion_configsource codeOpen in Cloud Shell
Catalog_service.get_default_branchsource codeOpen in Cloud Shell
Catalog_service.list_catalogssource codeOpen in Cloud Shell
Catalog_service.remove_catalog_attributesource codeOpen in Cloud Shell
Catalog_service.replace_catalog_attributesource codeOpen in Cloud Shell
Catalog_service.set_default_branchsource codeOpen in Cloud Shell
Catalog_service.update_attributes_configsource codeOpen in Cloud Shell
Catalog_service.update_catalogsource codeOpen in Cloud Shell
Catalog_service.update_completion_configsource codeOpen in Cloud Shell
Completion_service.complete_querysource codeOpen in Cloud Shell
Completion_service.import_completion_datasource codeOpen in Cloud Shell
Control_service.create_controlsource codeOpen in Cloud Shell
Control_service.delete_controlsource codeOpen in Cloud Shell
Control_service.get_controlsource codeOpen in Cloud Shell
Control_service.list_controlssource codeOpen in Cloud Shell
Control_service.update_controlsource codeOpen in Cloud Shell
Generative_question_service.batch_update_generative_question_configssource codeOpen in Cloud Shell
Generative_question_service.get_generative_questions_feature_configsource codeOpen in Cloud Shell
Generative_question_service.list_generative_question_configssource codeOpen in Cloud Shell
Generative_question_service.update_generative_question_configsource codeOpen in Cloud Shell
Generative_question_service.update_generative_questions_feature_configsource codeOpen in Cloud Shell
Model_service.create_modelsource codeOpen in Cloud Shell
Model_service.delete_modelsource codeOpen in Cloud Shell
Model_service.get_modelsource codeOpen in Cloud Shell
Model_service.list_modelssource codeOpen in Cloud Shell
Model_service.pause_modelsource codeOpen in Cloud Shell
Model_service.resume_modelsource codeOpen in Cloud Shell
Model_service.tune_modelsource codeOpen in Cloud Shell
Model_service.update_modelsource codeOpen in Cloud Shell
Prediction_service.predictsource codeOpen in Cloud Shell
Product_service.add_fulfillment_placessource codeOpen in Cloud Shell
Product_service.add_local_inventoriessource codeOpen in Cloud Shell
Product_service.create_productsource codeOpen in Cloud Shell
Product_service.delete_productsource codeOpen in Cloud Shell
Product_service.get_productsource codeOpen in Cloud Shell
Product_service.import_productssource codeOpen in Cloud Shell
Product_service.list_productssource codeOpen in Cloud Shell
Product_service.purge_productssource codeOpen in Cloud Shell
Product_service.remove_fulfillment_placessource codeOpen in Cloud Shell
Product_service.remove_local_inventoriessource codeOpen in Cloud Shell
Product_service.set_inventorysource codeOpen in Cloud Shell
Product_service.update_productsource codeOpen in Cloud Shell
Search_service.searchsource codeOpen in Cloud Shell
Serving_config_service.add_controlsource codeOpen in Cloud Shell
Serving_config_service.create_serving_configsource codeOpen in Cloud Shell
Serving_config_service.delete_serving_configsource codeOpen in Cloud Shell
Serving_config_service.get_serving_configsource codeOpen in Cloud Shell
Serving_config_service.list_serving_configssource codeOpen in Cloud Shell
Serving_config_service.remove_controlsource codeOpen in Cloud Shell
Serving_config_service.update_serving_configsource codeOpen in Cloud Shell
User_event_service.collect_user_eventsource codeOpen in Cloud Shell
User_event_service.import_user_eventssource codeOpen in Cloud Shell
User_event_service.purge_user_eventssource codeOpen in Cloud Shell
User_event_service.rejoin_user_eventssource codeOpen in Cloud Shell
User_event_service.write_user_eventsource codeOpen in Cloud Shell
Analytics_service.export_analytics_metricssource codeOpen in Cloud Shell
Branch_service.get_branchsource codeOpen in Cloud Shell
Branch_service.list_branchessource codeOpen in Cloud Shell
Catalog_service.add_catalog_attributesource codeOpen in Cloud Shell
Catalog_service.batch_remove_catalog_attributessource codeOpen in Cloud Shell
Catalog_service.get_attributes_configsource codeOpen in Cloud Shell
Catalog_service.get_completion_configsource codeOpen in Cloud Shell
Catalog_service.get_default_branchsource codeOpen in Cloud Shell
Catalog_service.list_catalogssource codeOpen in Cloud Shell
Catalog_service.remove_catalog_attributesource codeOpen in Cloud Shell
Catalog_service.replace_catalog_attributesource codeOpen in Cloud Shell
Catalog_service.set_default_branchsource codeOpen in Cloud Shell
Catalog_service.update_attributes_configsource codeOpen in Cloud Shell
Catalog_service.update_catalogsource codeOpen in Cloud Shell
Catalog_service.update_completion_configsource codeOpen in Cloud Shell
Completion_service.complete_querysource codeOpen in Cloud Shell
Completion_service.import_completion_datasource codeOpen in Cloud Shell
Control_service.create_controlsource codeOpen in Cloud Shell
Control_service.delete_controlsource codeOpen in Cloud Shell
Control_service.get_controlsource codeOpen in Cloud Shell
Control_service.list_controlssource codeOpen in Cloud Shell
Control_service.update_controlsource codeOpen in Cloud Shell
Generative_question_service.batch_update_generative_question_configssource codeOpen in Cloud Shell
Generative_question_service.get_generative_questions_feature_configsource codeOpen in Cloud Shell
Generative_question_service.list_generative_question_configssource codeOpen in Cloud Shell
Generative_question_service.update_generative_question_configsource codeOpen in Cloud Shell
Generative_question_service.update_generative_questions_feature_configsource codeOpen in Cloud Shell
Merchant_center_account_link_service.create_merchant_center_account_linksource codeOpen in Cloud Shell
Merchant_center_account_link_service.delete_merchant_center_account_linksource codeOpen in Cloud Shell
Merchant_center_account_link_service.list_merchant_center_account_linkssource codeOpen in Cloud Shell
Model_service.create_modelsource codeOpen in Cloud Shell
Model_service.delete_modelsource codeOpen in Cloud Shell
Model_service.get_modelsource codeOpen in Cloud Shell
Model_service.list_modelssource codeOpen in Cloud Shell
Model_service.pause_modelsource codeOpen in Cloud Shell
Model_service.resume_modelsource codeOpen in Cloud Shell
Model_service.tune_modelsource codeOpen in Cloud Shell
Model_service.update_modelsource codeOpen in Cloud Shell
Prediction_service.predictsource codeOpen in Cloud Shell
Product_service.add_fulfillment_placessource codeOpen in Cloud Shell
Product_service.add_local_inventoriessource codeOpen in Cloud Shell
Product_service.create_productsource codeOpen in Cloud Shell
Product_service.delete_productsource codeOpen in Cloud Shell
Product_service.export_productssource codeOpen in Cloud Shell
Product_service.get_productsource codeOpen in Cloud Shell
Product_service.import_productssource codeOpen in Cloud Shell
Product_service.list_productssource codeOpen in Cloud Shell
Product_service.purge_productssource codeOpen in Cloud Shell
Product_service.remove_fulfillment_placessource codeOpen in Cloud Shell
Product_service.remove_local_inventoriessource codeOpen in Cloud Shell
Product_service.set_inventorysource codeOpen in Cloud Shell
Product_service.update_productsource codeOpen in Cloud Shell
Project_service.accept_termssource codeOpen in Cloud Shell
Project_service.enroll_solutionsource codeOpen in Cloud Shell
Project_service.get_alert_configsource codeOpen in Cloud Shell
Project_service.get_logging_configsource codeOpen in Cloud Shell
Project_service.get_projectsource codeOpen in Cloud Shell
Project_service.list_enrolled_solutionssource codeOpen in Cloud Shell
Project_service.update_alert_configsource codeOpen in Cloud Shell
Project_service.update_logging_configsource codeOpen in Cloud Shell
Search_service.searchsource codeOpen in Cloud Shell
Serving_config_service.add_controlsource codeOpen in Cloud Shell
Serving_config_service.create_serving_configsource codeOpen in Cloud Shell
Serving_config_service.delete_serving_configsource codeOpen in Cloud Shell
Serving_config_service.get_serving_configsource codeOpen in Cloud Shell
Serving_config_service.list_serving_configssource codeOpen in Cloud Shell
Serving_config_service.remove_controlsource codeOpen in Cloud Shell
Serving_config_service.update_serving_configsource codeOpen in Cloud Shell
User_event_service.collect_user_eventsource codeOpen in Cloud Shell
User_event_service.export_user_eventssource codeOpen in Cloud Shell
User_event_service.import_user_eventssource codeOpen in Cloud Shell
User_event_service.purge_user_eventssource codeOpen in Cloud Shell
User_event_service.rejoin_user_eventssource codeOpen in Cloud Shell
User_event_service.write_user_eventsource codeOpen in Cloud Shell
Analytics_service.export_analytics_metricssource codeOpen in Cloud Shell
Catalog_service.add_catalog_attributesource codeOpen in Cloud Shell
Catalog_service.batch_remove_catalog_attributessource codeOpen in Cloud Shell
Catalog_service.get_attributes_configsource codeOpen in Cloud Shell
Catalog_service.get_completion_configsource codeOpen in Cloud Shell
Catalog_service.get_default_branchsource codeOpen in Cloud Shell
Catalog_service.list_catalogssource codeOpen in Cloud Shell
Catalog_service.remove_catalog_attributesource codeOpen in Cloud Shell
Catalog_service.replace_catalog_attributesource codeOpen in Cloud Shell
Catalog_service.set_default_branchsource codeOpen in Cloud Shell
Catalog_service.update_attributes_configsource codeOpen in Cloud Shell
Catalog_service.update_catalogsource codeOpen in Cloud Shell
Catalog_service.update_completion_configsource codeOpen in Cloud Shell
Completion_service.complete_querysource codeOpen in Cloud Shell
Completion_service.import_completion_datasource codeOpen in Cloud Shell
Control_service.create_controlsource codeOpen in Cloud Shell
Control_service.delete_controlsource codeOpen in Cloud Shell
Control_service.get_controlsource codeOpen in Cloud Shell
Control_service.list_controlssource codeOpen in Cloud Shell
Control_service.update_controlsource codeOpen in Cloud Shell
Generative_question_service.batch_update_generative_question_configssource codeOpen in Cloud Shell
Generative_question_service.get_generative_questions_feature_configsource codeOpen in Cloud Shell
Generative_question_service.list_generative_question_configssource codeOpen in Cloud Shell
Generative_question_service.update_generative_question_configsource codeOpen in Cloud Shell
Generative_question_service.update_generative_questions_feature_configsource codeOpen in Cloud Shell
Model_service.create_modelsource codeOpen in Cloud Shell
Model_service.delete_modelsource codeOpen in Cloud Shell
Model_service.get_modelsource codeOpen in Cloud Shell
Model_service.list_modelssource codeOpen in Cloud Shell
Model_service.pause_modelsource codeOpen in Cloud Shell
Model_service.resume_modelsource codeOpen in Cloud Shell
Model_service.tune_modelsource codeOpen in Cloud Shell
Model_service.update_modelsource codeOpen in Cloud Shell
Prediction_service.predictsource codeOpen in Cloud Shell
Product_service.add_fulfillment_placessource codeOpen in Cloud Shell
Product_service.add_local_inventoriessource codeOpen in Cloud Shell
Product_service.create_productsource codeOpen in Cloud Shell
Product_service.delete_productsource codeOpen in Cloud Shell
Product_service.export_productssource codeOpen in Cloud Shell
Product_service.get_productsource codeOpen in Cloud Shell
Product_service.import_productssource codeOpen in Cloud Shell
Product_service.list_productssource codeOpen in Cloud Shell
Product_service.purge_productssource codeOpen in Cloud Shell
Product_service.remove_fulfillment_placessource codeOpen in Cloud Shell
Product_service.remove_local_inventoriessource codeOpen in Cloud Shell
Product_service.set_inventorysource codeOpen in Cloud Shell
Product_service.update_productsource codeOpen in Cloud Shell
Project_service.get_alert_configsource codeOpen in Cloud Shell
Project_service.update_alert_configsource codeOpen in Cloud Shell
Search_service.searchsource codeOpen in Cloud Shell
Serving_config_service.add_controlsource codeOpen in Cloud Shell
Serving_config_service.create_serving_configsource codeOpen in Cloud Shell
Serving_config_service.delete_serving_configsource codeOpen in Cloud Shell
Serving_config_service.get_serving_configsource codeOpen in Cloud Shell
Serving_config_service.list_serving_configssource codeOpen in Cloud Shell
Serving_config_service.remove_controlsource codeOpen in Cloud Shell
Serving_config_service.update_serving_configsource codeOpen in Cloud Shell
User_event_service.collect_user_eventsource codeOpen in Cloud Shell
User_event_service.export_user_eventssource codeOpen in Cloud Shell
User_event_service.import_user_eventssource codeOpen in Cloud Shell
User_event_service.purge_user_eventssource codeOpen in Cloud Shell
User_event_service.rejoin_user_eventssource codeOpen in Cloud Shell
User_event_service.write_user_eventsource codeOpen in Cloud Shell
Quickstartsource codeOpen in Cloud Shell

TheRetail API Node.js Client API Reference documentationalso contains samples.

Supported Node.js Versions

Our client libraries follow theNode.js release schedule.Libraries are compatible with all currentactive andmaintenance versions ofNode.js.If you are using an end-of-life version of Node.js, we recommend that you updateas soon as possible to an actively supported LTS version.

Google's client libraries support legacy versions of Node.js runtimes on abest-efforts basis with the following warnings:

  • Legacy versions are not tested in continuous integration.
  • Some security patches and features cannot be backported.
  • Dependencies cannot be kept up-to-date.

Client libraries targeting some end-of-life versions of Node.js are available, andcan be installed through npmdist-tags.The dist-tags follow the naming conventionlegacy-(version).For example,npm install @google-cloud/retail@legacy-8 installs client librariesfor versions compatible with Node.js 8.

Versioning

This library followsSemantic Versioning.

This library is considered to bestable. The code surface will not change in backwards-incompatible waysunless absolutely necessary (e.g. because of critical security issues) or withan extensive deprecation period. Issues and requests againststable librariesare addressed with the highest priority.

More Information:Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See theContributing Guide.

Please note that thisREADME.md, thesamples/README.md,and a variety of configuration files in this repository (including.nycrc andtsconfig.json)are generated from a central template. To edit one of these files, make an editto its templates indirectory.

License

Apache Version 2.0

SeeLICENSE

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.