This is the documentation for Recommendations AI, Retail Search, and the new Retail console.

Method: projects.locations.catalogs.branches.products.purge

Permanently deletes all selected Products under a branch.

This process is asynchronous. If the request is valid, the removal will be enqueued and processed offline. Depending on the number of Products, this operation could take hours to complete. Before the operation completes, some Products may still be returned by ProductService.GetProduct or ProductService.ListProducts.

Depending on the number of Products, this operation could take hours to complete. To get a sample of Products that would be deleted, set PurgeProductsRequest.force to false.

HTTP request

POST https://retail.googleapis.com/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:purge

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
parent

string

Required. The resource name of the branch under which the products are created. The format is projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}

Request body

The request body contains data with the following structure:

JSON representation
{
  "filter": string,
  "force": boolean
}
Fields
filter

string

Required. The filter string to specify the products to be deleted with a length limit of 5,000 characters.

Empty string filter is not allowed. "*" implies delete all items in a branch.

The eligible fields for filtering are:

Supported syntax:

  • Comparators (">", "<", ">=", "<=", "="). Examples:
  • createTime <= "2015-02-13T17:05:46Z"
  • availability = "IN_STOCK"
  • Conjunctions ("AND") Examples:

  • createTime <= "2015-02-13T17:05:46Z" AND availability = "PREORDER"
  • Disjunctions ("OR") Examples:

  • createTime <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK"
  • Can support nested queries. Examples:

  • (createTime <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") OR (createTime >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK")
  • Filter Limits:

  • Filter should not contain more than 6 conditions.
  • Max nesting depth should not exceed 2 levels.

Examples queries: * Delete back order products created before a timestamp. createTime <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER"

force

boolean

Actually perform the purge. If force is set to false, the method will return the expected purge count without deleting any products.

Response body

If successful, the response body contains an instance of Operation.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.