Crea un conjunto de productos

Un conjunto de productos es un contenedor simple para un grupo de productos.

Crea un conjunto de productos vacío

Es mejor usar un solo conjunto de productos para todos tus elementos y crear conjuntos de productos adicionales a fin de realizar pruebas cuando lo necesites. En los siguientes códigos de muestra, se indica cómo crear un conjunto de productos vacío.

LÍNEA DE CMD Y REST

Antes de usar cualquiera de los siguientes datos de solicitud, realiza estos reemplazos:

  • project-id: El ID de tu proyecto de GCP
  • location-id: Un identificador de ubicación válido. Los identificadores de ubicación válidos son: us-west1, us-east1, europe-west1 y asia-east1
  • display-name: El nombre visible de la string que elijas

Método HTTP y URL:

POST https://vision.googleapis.com/v1/projects/project-id/locations/location-id/productSets

Cuerpo JSON de la solicitud:

{
  "displayName": "display-name"
}

Para enviar tu solicitud, elige una de estas opciones:

curl

Guarda el cuerpo de la solicitud en un archivo llamado request.json y ejecuta el siguiente comando:

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
https://vision.googleapis.com/v1/projects/project-id/locations/location-id/productSets

PowerShell

Guarda el cuerpo de la solicitud en un archivo llamado request.json y ejecuta el siguiente comando:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://vision.googleapis.com/v1/projects/project-id/locations/location-id/productSets" | Select-Object -Expand Content

Si la solicitud se realiza de forma correcta, el servidor muestra un código de estado HTTP 200 OK y la respuesta en formato JSON.

Deberías ver un resultado similar al siguiente. Puede usar el ID del conjunto de productos (b6d809615b6dd675, en este caso) para realizar otras operaciones en el conjunto.

{
  "name": "projects/project-id/locations/location-id/productSets/b6d809615b6dd675",
  "displayName": "new-product-set"
}

C#

        private static object CreateProductSet(CreateProductSetsOptions opts)
        {
            var client = ProductSearchClient.Create();

            // Create a product set with the product set specification in the region.
            var request = new CreateProductSetRequest
            {
                // A resource that represents Google Cloud Platform location
                ParentAsLocationName = new LocationName(opts.ProjectID,
                                                        opts.ComputeRegion),
                ProductSetId = opts.ProductSetId,
                ProductSet = new ProductSet
                {
                    DisplayName = opts.ProductSetDisplayName
                }
            };

            // The response is the product set with the `name` populated
            var response = client.CreateProductSet(request);

            Console.WriteLine($"Product set name: {response.DisplayName}");

            return 0;
        }

Go


import (
	"context"
	"fmt"
	"io"

	vision "cloud.google.com/go/vision/apiv1"
	visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1"
)

// createProductSet creates a product set.
func createProductSet(w io.Writer, projectID string, location string, productSetID string, productSetDisplayName string) error {
	ctx := context.Background()
	c, err := vision.NewProductSearchClient(ctx)
	if err != nil {
		return fmt.Errorf("NewProductSearchClient: %v", err)
	}
	defer c.Close()

	req := &visionpb.CreateProductSetRequest{
		Parent:       fmt.Sprintf("projects/%s/locations/%s", projectID, location),
		ProductSetId: productSetID,
		ProductSet: &visionpb.ProductSet{
			DisplayName: productSetDisplayName,
		},
	}

	resp, err := c.CreateProductSet(ctx, req)
	if err != nil {
		return fmt.Errorf("CreateProductSet: %v", err)
	}

	fmt.Fprintf(w, "Product set name: %s\n", resp.Name)

	return nil
}

Java

/**
 * Create a product set
 *
 * @param projectId - Id of the project.
 * @param computeRegion - Region name.
 * @param productSetId - Id of the product set.
 * @param productSetDisplayName - Display name of the product set.
 * @throws IOException - on I/O errors.
 */
public static void createProductSet(
    String projectId, String computeRegion, String productSetId, String productSetDisplayName)
    throws IOException {
  try (ProductSearchClient client = ProductSearchClient.create()) {

    // A resource that represents Google Cloud Platform location.
    String formattedParent = ProductSearchClient.formatLocationName(projectId, computeRegion);

    // Create a product set with the product set specification in the region.
    ProductSet myProductSet =
        ProductSet.newBuilder().setDisplayName(productSetDisplayName).build();
    CreateProductSetRequest request =
        CreateProductSetRequest.newBuilder()
            .setParent(formattedParent)
            .setProductSet(myProductSet)
            .setProductSetId(productSetId)
            .build();
    ProductSet productSet = client.createProductSet(request);
    // Display the product set information
    System.out.println(String.format("Product set name: %s", productSet.getName()));
  }
}

Node.js

// Imports the Google Cloud client library
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ProductSearchClient();

async function createProductSet() {
  /**
   * TODO(developer): Uncomment the following line before running the sample.
   */
  // const projectId = 'Your Google Cloud project Id';
  // const location = 'A compute region name';
  // const productSetId = 'Id of the product set';
  // const productSetDisplayName = 'Display name of the product set';

  // Resource path that represents Google Cloud Platform location.
  const locationPath = client.locationPath(projectId, location);

  const productSet = {
    displayName: productSetDisplayName,
  };

  const request = {
    parent: locationPath,
    productSet: productSet,
    productSetId: productSetId,
  };

  const [createdProductSet] = await client.createProductSet(request);
  console.log(`Product Set name: ${createdProductSet.name}`);
}
createProductSet();

PHP

namespace Google\Cloud\Samples\Vision;

use Google\Cloud\Vision\V1\ProductSearchClient;
use Google\Cloud\Vision\V1\ProductSet;

/**
 * Create a product set
 *
 * @param string $projectId Your Google Cloud project ID
 * @param string $location Google Cloud compute region name
 * @param string $productSetId ID of the product set
 * @param string $productSetDisplayName Display name of the product set
 */
function product_set_create($projectId, $location, $productSetId, $productSetDisplayName)
{
    $client = new ProductSearchClient();

    # a resource that represents Google Cloud Platform location.
    $locationPath = $client->locationName($projectId, $location);

    # create a product set with the product set specification in the region.
    $productSet = (new ProductSet())
        ->setDisplayName($productSetDisplayName);

    # the response is the product set with the `name` field populated.
    $response = $client->createProductSet($locationPath, $productSet, ['productSetId' => $productSetId]);

    # display the product information.
    printf('Product set name: %s' . PHP_EOL, $response->getName());

    $client->close();
}

Python

from google.cloud import vision

def create_product_set(
        project_id, location, product_set_id, product_set_display_name):
    """Create a product set.
    Args:
        project_id: Id of the project.
        location: A compute region name.
        product_set_id: Id of the product set.
        product_set_display_name: Display name of the product set.
    """
    client = vision.ProductSearchClient()

    # A resource that represents Google Cloud Platform location.
    location_path = f"projects/{project_id}/locations/{location}"

    # Create a product set with the product set specification in the region.
    product_set = vision.ProductSet(
            display_name=product_set_display_name)

    # The response is the product set with `name` populated.
    response = client.create_product_set(
        parent=location_path,
        product_set=product_set,
        product_set_id=product_set_id)

    # Display the product set information.
    print('Product set name: {}'.format(response.name))

Ruby

require "google/cloud/vision"

def product_search_create_product_set project_id = "your-project-id"
  client = Google::Cloud::Vision.product_search

  # A resource that represents Google Cloud Platform location.
  location = "us-west1" # specify a compute region name
  location_path = client.location_path project: project_id, location: location

  # Create a product set with the product set specification in the region.
  product_set = {
    display_name: "display-name"
  }

  # The response is the product set with `name` populated.
  product_set = client.create_product_set parent:      location_path,
                                          product_set: product_set

  # Display the product set information.
  puts "Product set name: #{product_set.name}"
end

Usa una importación masiva para crear un conjunto de productos con productos

También puedes usar la función de importación masiva para hacer las siguientes acciones en simultáneo: crear un conjunto de productos, crear productos múltiples y sus imágenes de referencia.

Se establecen varias referencias para el conjunto de productos, los productos y las imágenes de referencia en el archivo CSV de importación masiva que uses. Para obtener más información, consulta Da formato a un archivo CSV de importación masiva.

Realiza una importación masiva mediante la ejecución del siguiente código:

LÍNEA DE CMD Y REST

Antes de usar cualquiera de los siguientes datos de solicitud, realiza estos reemplazos:

  • project-id: El ID de tu proyecto de GCP
  • location-id: Un identificador de ubicación válido. Los identificadores de ubicación válidos son: us-west1, us-east1, europe-west1 y asia-east1
  • storage-path: Un depósito o directorio de Cloud Storage en los que se almacena el archivo CSV de entrada. El usuario que realice la solicitud debe tener, como mínimo, permiso de lectura en el bucket

Método HTTP y URL:

POST https://vision.googleapis.com/v1/projects/project-id/locations/location-id/productSets:import

Cuerpo JSON de la solicitud:

{
  "inputConfig": {
    "gcsSource": {
      "csvFileUri": "storage-path"
    }
  }
}

Para enviar tu solicitud, elige una de estas opciones:

curl

Guarda el cuerpo de la solicitud en un archivo llamado request.json y ejecuta el siguiente comando:

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
https://vision.googleapis.com/v1/projects/project-id/locations/location-id/productSets:import

PowerShell

Guarda el cuerpo de la solicitud en un archivo llamado request.json y ejecuta el siguiente comando:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://vision.googleapis.com/v1/projects/project-id/locations/location-id/productSets:import" | Select-Object -Expand Content

Deberías ver un resultado similar al siguiente. Puedes usar el ID de operación (f10f34e32c40a710, en este caso) para obtener el estado de la tarea. Para ver un ejemplo, consulta Obtén el estado de una operación:

{
  "name": "projects/project-id/locations/location-id/operations/f10f34e32c40a710"
}

Una vez que se complete la operación de larga duración, puedes obtener los detalles de la operación de importación. La respuesta debería ser similar a la siguiente:

{
  "name": "locations/location-id/operations/f10f34e32c40a710",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.vision.v1.BatchOperationMetadata",
    "state": "SUCCESSFUL",
    "submitTime": "2019-12-06T21:16:04.476466873Z",
    "endTime": "2019-12-06T21:16:40.594258084Z"
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.vision.v1.ImportProductSetsResponse",
    "referenceImages": [
      {
        "name": "projects/project-id/locations/location-id/products/product_id0/referenceImages/image0",
        "uri": "gs://my-storage-bucket/img_039.jpg"
      },
      {
        "name": "projects/project-id/locations/location-id/products/product_id1/referenceImages/image1",
        "uri": "gs://my-storage-bucket/img_105.jpg"
      },
      {
        "name": "projects/project-id/locations/location-id/products/product_id2/referenceImages/image2",
        "uri": "gs://my-storage-bucket/img_224.jpg"
      },
      {
        "name": "projects/project-id/locations/location-id/products/product_id3/referenceImages/image3",
        "uri": "gs://my-storage-bucket/img_385.jpg"
      }
    ],
    "statuses": [
      {},
      {},
      {},
      {}
    ]
  }
}

C#

private static int ImportProductSet(ImportProductSetOptions opts)
{
    var client = ProductSearchClient.Create();
    var request = new ImportProductSetsRequest
    {
        // A resource that represents Google Cloud Platform location.
        ParentAsLocationName = new LocationName(opts.ProjectID,
                                                opts.ComputeRegion),

        // Set the input configuration along with Google Cloud Storage URI
        InputConfig = new ImportProductSetsInputConfig
        {
            GcsSource = new ImportProductSetsGcsSource
            {
                CsvFileUri = opts.GcsUri
            }
        }
    };
    var response = client.ImportProductSets(request);

    // Synchronous check of operation status
    var completedResponse = response.PollUntilCompleted();

    if (completedResponse.IsCompleted)
    {
        var result = completedResponse.Result;

        foreach (var status in result.Statuses)
        {
            // Check status of reference image.
            // `0` is the code for OK in google.rpc.Code.
            if (status.Code == 0)
            {
                Console.WriteLine(result.ReferenceImages);
            }
            else
            {
                Console.WriteLine("No reference images.");
            }
        }
    }

    return 0;
}

Go



import (
	"context"
	"fmt"
	"io"

	vision "cloud.google.com/go/vision/apiv1"
	visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1"
)

// importProductSets creates a product set using information in a csv file on GCS.
func importProductSets(w io.Writer, projectID string, location string, gcsURI string) error {
	ctx := context.Background()
	c, err := vision.NewProductSearchClient(ctx)
	if err != nil {
		return fmt.Errorf("NewProductSearchClient: %v", err)
	}
	defer c.Close()

	req := &visionpb.ImportProductSetsRequest{
		Parent: fmt.Sprintf("projects/%s/locations/%s", projectID, location),
		InputConfig: &visionpb.ImportProductSetsInputConfig{
			Source: &visionpb.ImportProductSetsInputConfig_GcsSource{
				GcsSource: &visionpb.ImportProductSetsGcsSource{
					CsvFileUri: gcsURI,
				},
			},
		},
	}

	op, err := c.ImportProductSets(ctx, req)
	if err != nil {
		return fmt.Errorf("ImportProductSets: %v", err)
	}

	fmt.Fprintf(w, "Processing operation name: %s\n", op.Name())

	resp, err := op.Wait(ctx)
	if err != nil {
		return fmt.Errorf("Wait: %v", err)
	}

	fmt.Fprintf(w, "processing done.\n")

	for i, status := range resp.Statuses {
		// `0` is the coee for OK in google.rpc.code
		fmt.Fprintf(w, "Status of processing line %d of the csv: %d\n", i, status.Code)

		if status.Code == 0 {
			fmt.Fprintf(w, "Reference image name: %s\n", resp.ReferenceImages[i].Name)
		} else {
			fmt.Fprintf(w, "Status code not OK: %s\n", status.Message)
		}
	}

	return nil
}

Java

/**
 * Import images of different products in the product set.
 *
 * @param projectId - Id of the project.
 * @param computeRegion - Region name.
 * @param gcsUri - Google Cloud Storage URI.Target files must be in Product Search CSV format.
 * @throws Exception - on client errors.
 */
public static void importProductSets(String projectId, String computeRegion, String gcsUri)
    throws Exception {
  try (ProductSearchClient client = ProductSearchClient.create()) {

    // A resource that represents Google Cloud Platform location.
    String formattedParent = ProductSearchClient.formatLocationName(projectId, computeRegion);
    Builder gcsSource = ImportProductSetsGcsSource.newBuilder().setCsvFileUri(gcsUri);

    // Set the input configuration along with Google Cloud Storage URI
    ImportProductSetsInputConfig inputConfig =
        ImportProductSetsInputConfig.newBuilder().setGcsSource(gcsSource).build();

    // Import the product sets from the input URI.
    OperationFuture<ImportProductSetsResponse, BatchOperationMetadata> response =
        client.importProductSetsAsync(formattedParent, inputConfig);

    System.out.println(String.format("Processing operation name: %s", response.getName()));
    ImportProductSetsResponse results = response.get();
    System.out.println("Processing done.");
    System.out.println("Results of the processing:");

    for (int i = 0; i < results.getStatusesCount(); i++) {
      System.out.println(
          String.format(
              "Status of processing line %s of the csv: %s", i, results.getStatuses(i)));
      // Check the status of reference image.
      if (results.getStatuses(i).getCode() == 0) {
        ReferenceImage referenceImage = results.getReferenceImages(i);
        System.out.println(referenceImage);
      } else {
        System.out.println("No reference image.");
      }
    }
  }
}

Node.js

// Imports the Google Cloud client library
const vision = require('@google-cloud/vision');
// Creates a client
const client = new vision.ProductSearchClient();

async function importProductSets() {
  /**
   * TODO(developer): Uncomment the following line before running the sample.
   */
  // const projectId = 'Your Google Cloud project Id';
  // const location = 'A compute region name';
  // const gcsUri = 'Google Cloud Storage path of the input image'';

  // A resource that represents Google Cloud Platform location.
  const projectLocation = client.locationPath(projectId, location);

  // Set the input configuration along with Google Cloud Storage URI
  const inputConfig = {
    gcsSource: {
      csvFileUri: gcsUri,
    },
  };

  // Import the product sets from the input URI.
  const [response, operation] = await client.importProductSets({
    parent: projectLocation,
    inputConfig: inputConfig,
  });

  console.log('Processing operation name: ', operation.name);

  // synchronous check of operation status
  const [result] = await response.promise();
  console.log('Processing done.');
  console.log('Results of the processing:');

  for (const i in result.statuses) {
    console.log(
      'Status of processing ',
      i,
      'of the csv:',
      result.statuses[i]
    );

    // Check the status of reference image
    if (result.statuses[i].code === 0) {
      console.log(result.referenceImages[i]);
    } else {
      console.log('No reference image.');
    }
  }
}
importProductSets();

PHP

namespace Google\Cloud\Samples\Vision;

use Google\Cloud\Vision\V1\ProductSearchClient;
use Google\Cloud\Vision\V1\ImportProductSetsGcsSource;
use Google\Cloud\Vision\V1\ImportProductSetsInputConfig;

/**
 * Import images of different products in the product set.
 *
 * @param string $projectId Your Google Cloud Project ID
 * @param string $location Google Cloud compute region name
 * @param string $gcsUri Google Cloud Storage URI
 */
function product_set_import($projectId, $location, $gcsUri)
{
    $client = new ProductSearchClient();

    # a resource that represents Google Cloud Platform location.
    $locationPath = $client->locationName($projectId, $location);

    # set the input configuration along with Google Cloud Storage URI
    $gcsSource = (new ImportProductSetsGcsSource())
        ->setCsvFileUri($gcsUri);
    $inputConfig = (new ImportProductSetsInputConfig())
        ->setGcsSource($gcsSource);

    # import the product sets from the input URI
    $operation = $client->importProductSets($locationPath, $inputConfig);
    $operationName = $operation->getName();
    printf('Processing operation name: %s' . PHP_EOL, $operationName);

    $operation->pollUntilComplete();
    print('Processing done.' . PHP_EOL);

    if ($result = $operation->getResult()) {
        $referenceImages = $result->getReferenceImages();

        foreach ($result->getStatuses() as $count => $status) {
            printf('Status of processing line %d of the csv: ' . PHP_EOL, $count);
            # check the status of reference image
            # `0` is the code for OK in google.rpc.Code.
            if ($status->getCode() == 0) {
                $referenceImage = $referenceImages[$count];
                printf('name: %s' . PHP_EOL, $referenceImage->getName());
                printf('uri: %s' . PHP_EOL, $referenceImage->getUri());
            } else {
                printf('Status code not OK: %s' . PHP_EOL, $status->getMessage());
            }
        }
        print('IMPORTANT: You will need to wait up to 30 minutes for indexing to complete' . PHP_EOL);
    } else {
        printf('Error: %s' . PHP_EOL, $operation->getError()->getMessage());
    }

    $client->close();
}

Python

def import_product_sets(project_id, location, gcs_uri):
    """Import images of different products in the product set.
    Args:
        project_id: Id of the project.
        location: A compute region name.
        gcs_uri: Google Cloud Storage URI.
            Target files must be in Product Search CSV format.
    """
    client = vision.ProductSearchClient()

    # A resource that represents Google Cloud Platform location.
    location_path = f"projects/{project_id}/locations/{location}"

    # Set the input configuration along with Google Cloud Storage URI
    gcs_source = vision.ImportProductSetsGcsSource(
        csv_file_uri=gcs_uri)
    input_config = vision.ImportProductSetsInputConfig(
        gcs_source=gcs_source)

    # Import the product sets from the input URI.
    response = client.import_product_sets(
        parent=location_path, input_config=input_config)

    print('Processing operation name: {}'.format(response.operation.name))
    # synchronous check of operation status
    result = response.result()
    print('Processing done.')

    for i, status in enumerate(result.statuses):
        print('Status of processing line {} of the csv: {}'.format(
            i, status))
        # Check the status of reference image
        # `0` is the code for OK in google.rpc.Code.
        if status.code == 0:
            reference_image = result.reference_images[i]
            print(reference_image)
        else:
            print('Status code not OK: {}'.format(status.message))

Ruby

require "google/cloud/vision"

def product_search_import_product_sets project_id = "your-project-id",
                                       location   = "us-west1"

  client = Google::Cloud::Vision.product_search

  # A resource that represents Google Cloud Platform location.
  location_path = client.location_path project: project_id, location: location

  # Set the input configuration along with Google Cloud Storage URI
  input_config = {
    gcs_source: {
      csv_file_uri: "gs://cloud-samples-data/vision/product_search/product_sets.csv"
    }
  }

  # Import the product sets from the input URI.
  operation = client.import_product_sets parent:       location_path,
                                         input_config: input_config
  puts "Processing operation name: #{operation.name}"
  operation.wait_until_done! # Waits for the operation to complete

  puts "Processing done."

  result = operation.response
  result.statuses.each_with_index do |status, index|
    puts "Status of processing line #{index} of the csv: #{status.code}"

    # Check the status of reference image
    # `0` is the code for OK in google.rpc.Code.
    if status.code.zero?
      reference_image = result.reference_images[index]
      puts reference_image.uri
    else
      puts "Status code not OK: #{status.message}"
    end
  end
end

Obtén el estado de una operación

Varias de las operaciones que solicitas son de larga duración, como la creación de conjuntos de productos mediante la importación masiva, y la eliminación definitiva de un conjunto de productos y de productos huérfanos. Estos tipos de solicitud mostrarán un JSON con un ID de operación que puedes usar para obtener el estado de la operación.

Por ejemplo, una solicitud de eliminación por lotes (purge) muestra el siguiente JSON:

{
"name": "projects/project-id/locations/location-id/operations/bc4e1d412863e626"
}

En este caso, el ID de operación es bc4e1d412863e626. En los siguientes ejemplos, se muestra cómo obtener el estado de esta operación con este ID.

LÍNEA DE CMD Y REST

Antes de usar cualquiera de los siguientes datos de solicitud, realiza estos reemplazos:

  • location-id: Un identificador de ubicación válido. Los identificadores de ubicación válidos son: us-west1, us-east1, europe-west1 y asia-east1.
  • operation-id: El ID de la operación. El ID es el último elemento del nombre de la operación. Por ejemplo:
    • Nombre de la operación: projects/project-id/locations/location-id/operations/bc4e1d412863e626
    • ID de la operación: bc4e1d412863e626

Método HTTP y URL:

GET https://vision.googleapis.com/v1/locations/location-id/operations/operation-id

Para enviar tu solicitud, elige una de estas opciones:

curl

Ejecuta el siguiente comando:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
https://vision.googleapis.com/v1/locations/location-id/operations/operation-id

PowerShell

Ejecuta el siguiente comando:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://vision.googleapis.com/v1/locations/location-id/operations/operation-id" | Select-Object -Expand Content
Deberías ver un resultado similar al siguiente para una operación de eliminación definitiva del conjunto de productos completada:
{
  "name": "locations/location-id/operations/operation-id",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.vision.v1.BatchOperationMetadata",
    "state": "SUCCESSFUL",
    "submitTime": "2019-09-04T15:58:39.131591882Z",
    "endTime": "2019-09-04T15:58:43.099020580Z"
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.vision.v1.PurgeProductsRequest",
    "parent": "projects/project-id/locations/location-id",
    "productSetPurgeConfig": {
      "productSetId": "project-set-id"
    },
    "force": true
  }
}

Deberías ver un resultado similar al siguiente para una operación de eliminación definitiva de productos huérfanos completada:

{
  "name": "locations/location-id/operations/operation-id",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.vision.v1.BatchOperationMetadata",
    "state": "SUCCESSFUL",
    "submitTime": "2019-09-04T16:08:38.278197397Z",
    "endTime": "2019-09-04T16:08:45.075778639Z"
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.vision.v1.PurgeProductsRequest",
    "parent": "projects/project-id/locations/location-id",
    "deleteOrphanProducts": true,
    "force": true
  }
}