יצירה וניהול של משאבי מוצרים

אחרי שיוצרים קבוצת מוצרים, אפשר ליצור מוצרים ולהוסיף אותם לקבוצת המוצרים. כשיוצרים מוצר, צריך לספק שם לתצוגה של המוצר וקטגוריית מוצרים. הקטגוריות הנתמכות כרגע הן: homegoods-v2, ‏ apparel-v2, toys-v2, ‏ packagedgoods-v1, ו-general-v1 *.

אפשר גם לספק תיאור אופציונלי של המוצר, ותוויות אופציונליות למוצר. תוויות הן צמדי מפתח/ערך שמתארים את המוצר, כמו color=black או style=mens. אפשר לכלול תוויות כדי לסנן את תוצאות החיפוש של מוצר מסוים, כך שיוצגו רק תמונות מסוימות של המוצר.

יצירת מוצר

אפשר להשתמש באפשרות 'ייבוא אונליין' כדי ליצור מוצר בודד. אחרי שיוצרים מוצר, אפשר להוסיף לו תמונה לדוגמה או להוסיף אותו לקבוצת מוצרים אחת או יותר.

REST

לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:

  • PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
  • LOCATION_ID: מזהה מיקום תקין. מזהי מיקום תקינים: us-west1,‏ us-east1,‏ europe-west1 ו-asia-east1.
  • DISPLAY_NAME: שם מוצג במחרוזת לפי בחירתכם.
  • PRODUCT_DESCRIPTION: תיאור מחרוזת לפי בחירתכם.
  • product-category: קטגוריית מוצר תקינה. קטגוריות המוצרים שזמינות כרגע הן: homegoods-v2, apparel-v2, toys-v2, packagedgoods-v1 ו-general-v1.
  • productLabels: צמד מפתח/ערך אחד או יותר שמשויכים למוצר. לכל KEY_STRING צריך להיות VALUE_STRING משויך.

ה-method של ה-HTTP וכתובת ה-URL:

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

גוף בקשת JSON:

{
  "displayName": "display-name",
  "description": "product-description",
  "productCategory": "product-category",
  "productLabels": [
      {
        "key": "key-string",
        "value": "value-string"
      }
  ]
}

כדי לשלוח את הבקשה עליכם לבחור אחת מהאפשרויות הבאות:

curl

שומרים את גוף הבקשה בקובץ בשם request.json ומריצים את הפקודה הבאה:

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

PowerShell

שומרים את גוף הבקשה בקובץ בשם request.json ומריצים את הפקודה הבאה:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-id" }

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/products" | Select-Object -Expand Content

דוגמה לגוף הבקשה:

{
  "displayName": "sample-product-1234",
  "description": "Athletic shorts",
  "productCategory": "apparel-v2",
  "productLabels": [
      {
        "key": "style",
        "value": "womens"
      },
      {
        "key": "color",
        "value": "blue"
      }
  ]
}

אם הבקשה תתבצע בהצלחה, השרת יחזיר קוד סטטוס 200 OK של HTTP ואת התשובה בפורמט JSON.

הפלט שיוצג אמור להיות דומה לזה שמופיע כאן. אפשר להשתמש במזהה המוצר (37b9811d308c4e42 במקרה הזה) כדי לבצע פעולות אחרות על המוצר.

{
  "name": "projects/project-id/locations/location-id/products/37b9811d308c4e42",
  "displayName": "sample-product-456",
  "description": "Athletic shorts",
  "productCategory": "apparel-v2",
  "productLabels": [
    {
      "key": "style",
      "value": "womens"
    },
    {
      "key": "color",
      "value": "blue"
    }
  ]
}

Go

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Go API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.


import (
	"context"
	"fmt"
	"io"

	vision "cloud.google.com/go/vision/apiv1"
	"cloud.google.com/go/vision/v2/apiv1/visionpb"
)

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

	req := &visionpb.CreateProductRequest{
		Parent:    fmt.Sprintf("projects/%s/locations/%s", projectID, location),
		ProductId: productID,
		Product: &visionpb.Product{
			DisplayName:     productDisplayName,
			ProductCategory: productCategory,
		},
	}

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

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

	return nil
}

Java

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Java API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

/**
 * Create one product.
 *
 * @param projectId - Id of the project.
 * @param computeRegion - Region name.
 * @param productId - Id of the product.
 * @param productDisplayName - Display name of the product.
 * @param productCategory - Category of the product.
 * @throws IOException - on I/O errors.
 */
public static void createProduct(
    String projectId,
    String computeRegion,
    String productId,
    String productDisplayName,
    String productCategory)
    throws IOException {
  try (ProductSearchClient client = ProductSearchClient.create()) {

    // A resource that represents Google Cloud Platform location.
    String formattedParent = LocationName.format(projectId, computeRegion);
    // Create a product with the product specification in the region.
    // Multiple labels are also supported.
    Product myProduct =
        Product.newBuilder()
            .setName(productId)
            .setDisplayName(productDisplayName)
            .setProductCategory(productCategory)
            .build();
    Product product = client.createProduct(formattedParent, myProduct, productId);
    // Display the product information
    System.out.println(String.format("Product name: %s", product.getName()));
  }
}

Node.js

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Node.js API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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

// Creates a client
const client = new vision.ProductSearchClient();
async function createProduct() {
  /**
   * TODO(developer): Uncomment the following line before running the sample.
   */
  // const projectId = 'Your Google Cloud project Id';
  // const location = 'A compute region name';
  // const productId = 'Id of the product';
  // const productDisplayName = 'Display name of the product';
  // const productCategory = 'Catoegory of the product';

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

  const product = {
    displayName: productDisplayName,
    productCategory: productCategory,
  };

  const request = {
    parent: locationPath,
    product: product,
    productId: productId,
  };

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

Python

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Python API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

from google.cloud import vision
from google.protobuf import field_mask_pb2 as field_mask

def create_product(
    project_id, location, product_id, product_display_name, product_category
):
    """Create one product.
    Args:
        project_id: Id of the project.
        location: A compute region name.
        product_id: Id of the product.
        product_display_name: Display name of the product.
        product_category: Category of the product.
    """
    client = vision.ProductSearchClient()

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

    # Create a product with the product specification in the region.
    # Set product display name and product category.
    product = vision.Product(
        display_name=product_display_name, product_category=product_category
    )

    # The response is the product with the `name` field populated.
    response = client.create_product(
        parent=location_path, product=product, product_id=product_id
    )

    # Display the product information.
    print(f"Product name: {response.name}")


שפות נוספות

C#‎: צריך לפעול לפי הוראות ההגדרה של C# ‎ בדף של ספריות הלקוח ואז לעבור אל מאמרי העזרה בנושא Google Product Search ב-Vision API עבור ‎ .NET.

PHP: עליכם לפעול לפי הוראות ההגדרה של PHP בדף של ספריות הלקוח ואז לעבור אל מסמכי העזר של Google Product Search ב-Vision API ל-PHP.

Ruby: צריך לפעול לפי ההוראות להגדרת Ruby בדף של ספריות הלקוח ולעיין במסמכי העזר של Vision API Google Product Search ל-Ruby.

הוספת מוצר לקבוצת מוצרים

אחרי שיש לכם מוצר וקבוצת מוצרים, אתם יכולים להוסיף את המוצר לקבוצת המוצרים.

REST

לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:

  • PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
  • LOCATION_ID: מזהה מיקום תקין. מזהי מיקום תקינים: us-west1,‏ us-east1,‏ europe-west1 ו-asia-east1.
  • PRODUCT_SET_ID: המזהה של קבוצת המוצרים שרוצים להריץ עליה את הפעולה.
  • PRODUCT_NAME: שם המשאב המלא של המוצר. פורמט:
    • projects/PROJECT_ID/locations/LOCATION_ID/products/PRODUCT_ID

ה-method של ה-HTTP וכתובת ה-URL:

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

גוף בקשת JSON:

{
  "product": "product-name"
}

כדי לשלוח את הבקשה עליכם לבחור אחת מהאפשרויות הבאות:

curl

שומרים את גוף הבקשה בקובץ בשם request.json ומריצים את הפקודה הבאה:

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

PowerShell

שומרים את גוף הבקשה בקובץ בשם request.json ומריצים את הפקודה הבאה:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-id" }

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/product-set-id:addProduct" | Select-Object -Expand Content

אתם אמורים לקבל תגובת JSON שדומה לזו:

{}

Go

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Go API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.


import (
	"context"
	"fmt"
	"io"

	vision "cloud.google.com/go/vision/apiv1"
	"cloud.google.com/go/vision/v2/apiv1/visionpb"
)

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

	req := &visionpb.AddProductToProductSetRequest{
		Name:    fmt.Sprintf("projects/%s/locations/%s/productSets/%s", projectID, location, productSetID),
		Product: fmt.Sprintf("projects/%s/locations/%s/products/%s", projectID, location, productID),
	}

	if err = c.AddProductToProductSet(ctx, req); err != nil {
		return fmt.Errorf("NewProductSearchClient: %w", err)
	}

	fmt.Fprintf(w, "Product added to product set.\n")

	return nil
}

Java

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Java API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.


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

    // Get the full path of the product set.
    String formattedName = ProductSetName.format(projectId, computeRegion, productSetId);

    // Get the full path of the product.
    String productPath = ProductName.of(projectId, computeRegion, productId).toString();

    // Add the product to the product set.
    client.addProductToProductSet(formattedName, productPath);

    System.out.println(String.format("Product added to product set."));
  }
}

Node.js

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Node.js API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

const vision = require('@google-cloud/vision');
const client = new vision.ProductSearchClient();

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

  const productPath = client.productPath(projectId, location, productId);
  const productSetPath = client.productSetPath(
    projectId,
    location,
    productSetId
  );

  const request = {
    name: productSetPath,
    product: productPath,
  };

  await client.addProductToProductSet(request);
  console.log('Product added to product set.');
}
addProductToProductSet();

Python

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Python API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

from google.cloud import vision

def add_product_to_product_set(project_id, location, product_id, product_set_id):
    """Add a product to a product set.
    Args:
        project_id: Id of the project.
        location: A compute region name.
        product_id: Id of the product.
        product_set_id: Id of the product set.
    """
    client = vision.ProductSearchClient()

    # Get the full path of the product set.
    product_set_path = client.product_set_path(
        project=project_id, location=location, product_set=product_set_id
    )

    # Get the full path of the product.
    product_path = client.product_path(
        project=project_id, location=location, product=product_id
    )

    # Add the product to the product set.
    client.add_product_to_product_set(name=product_set_path, product=product_path)
    print("Product added to product set.")


שפות נוספות

C#‎: צריך לפעול לפי הוראות ההגדרה של C# ‎ בדף של ספריות הלקוח ואז לעבור אל מאמרי העזרה בנושא Google Product Search ב-Vision API עבור ‎ .NET.

PHP: עליכם לפעול לפי הוראות ההגדרה של PHP בדף של ספריות הלקוח ואז לעבור אל מסמכי העזר של Google Product Search ב-Vision API ל-PHP.

Ruby: צריך לפעול לפי ההוראות להגדרת Ruby בדף של ספריות הלקוח ולעיין במסמכי העזר של Vision API Google Product Search ל-Ruby.

הסרת מוצר מקבוצת מוצרים

אפשר גם להסיר מוצר קיים מקבוצת מוצרים.

REST

לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:

  • PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
  • LOCATION_ID: מזהה מיקום תקין. מזהי מיקום תקינים: us-west1,‏ us-east1,‏ europe-west1 ו-asia-east1.
  • PRODUCT_SET_ID: המזהה של קבוצת המוצרים שרוצים להריץ עליה את הפעולה.
  • PRODUCT_NAME: שם המשאב המלא של המוצר. פורמט:
    • projects/PROJECT_ID/locations/LOCATION_ID/products/PRODUCT_ID

ה-method של ה-HTTP וכתובת ה-URL:

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

גוף בקשת JSON:

{
  "product": "product-name"
}

כדי לשלוח את הבקשה עליכם לבחור אחת מהאפשרויות הבאות:

curl

שומרים את גוף הבקשה בקובץ בשם request.json ומריצים את הפקודה הבאה:

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

PowerShell

שומרים את גוף הבקשה בקובץ בשם request.json ומריצים את הפקודה הבאה:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "project-id" }

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/product-set-id:removeProduct" | Select-Object -Expand Content

אתם אמורים לקבל תגובת JSON שדומה לזו:

{}

Go

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Go API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.


import (
	"context"
	"fmt"
	"io"

	vision "cloud.google.com/go/vision/apiv1"
	"cloud.google.com/go/vision/v2/apiv1/visionpb"
)

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

	req := &visionpb.RemoveProductFromProductSetRequest{
		Name:    fmt.Sprintf("projects/%s/locations/%s/productSets/%s", projectID, location, productSetID),
		Product: fmt.Sprintf("projects/%s/locations/%s/products/%s", projectID, location, productID),
	}

	if err = c.RemoveProductFromProductSet(ctx, req); err != nil {
		return fmt.Errorf("NewProductSearchClient: %w", err)
	}

	fmt.Fprintf(w, "Product removed from product set.\n")

	return nil
}

Java

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Java API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.


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

    // Get the full path of the product set.
    String formattedParent = ProductSetName.format(projectId, computeRegion, productSetId);

    // Get the full path of the product.
    String formattedName = ProductName.format(projectId, computeRegion, productId);

    // Remove the product from the product set.
    client.removeProductFromProductSet(formattedParent, formattedName);

    System.out.println(String.format("Product removed from product set."));
  }
}

Node.js

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Node.js API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

const vision = require('@google-cloud/vision');

const client = new vision.ProductSearchClient();

async function removeProductFromProductSet() {
  /**
   * TODO(developer): Uncomment the following line before running the sample.
   */
  const productSetPath = client.productSetPath(
    projectId,
    location,
    productSetId
  );

  const productPath = client.productPath(projectId, location, productId);

  const request = {
    name: productSetPath,
    product: productPath,
  };

  await client.removeProductFromProductSet(request);
  console.log('Product removed from product set.');
}
removeProductFromProductSet();

Python

מידע על התקנת ספריית הלקוח של Vision API Google Product Search ושימוש בה מופיע במאמר ספריות הלקוח של Vision API Google Product Search. מידע נוסף מופיע במאמרי העזרה של Vision API Google Product Search Python API.

כדי לבצע אימות ב-Google Product Search של Vision API, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

from google.cloud import vision

def remove_product_from_product_set(project_id, location, product_id, product_set_id):
    """Remove a product from a product set.
    Args:
        project_id: Id of the project.
        location: A compute region name.
        product_id: Id of the product.
        product_set_id: Id of the product set.
    """
    client = vision.ProductSearchClient()

    # Get the full path of the product set.
    product_set_path = client.product_set_path(
        project=project_id, location=location, product_set=product_set_id
    )

    # Get the full path of the product.
    product_path = client.product_path(
        project=project_id, location=location, product=product_id
    )

    # Remove the product from the product set.
    client.remove_product_from_product_set(name=product_set_path, product=product_path)
    print("Product removed from product set.")


שפות נוספות

C#‎: צריך לפעול לפי הוראות ההגדרה של C# ‎ בדף של ספריות הלקוח ואז לעבור אל מאמרי העזרה בנושא Google Product Search ב-Vision API עבור ‎ .NET.

PHP: עליכם לפעול לפי הוראות ההגדרה של PHP בדף של ספריות הלקוח ואז לעבור אל מסמכי העזר של Google Product Search ב-Vision API ל-PHP.

Ruby: צריך לפעול לפי ההוראות להגדרת Ruby בדף של ספריות הלקוח ולעיין במסמכי העזר של Vision API Google Product Search ל-Ruby.