# Cloud Vision API . projects . locations . products

## Instance Methods

Returns the referenceImages Resource.

Creates and returns a new product resource.

Permanently deletes a product and its reference images.

Gets information associated with a Product.

Lists products in an unspecified order.

Retrieves the next page of results.

Makes changes to a Product resource.

### Method Details

`create(parent, body, x__xgafv=None, productId=None)`

    Creates and returns a new product resource.

    Possible errors:

    * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096
      characters.
    * Returns INVALID_ARGUMENT if description is longer than 4096 characters.
    * Returns INVALID_ARGUMENT if product_category is missing or invalid.

    Args:
      parent: string, The project in which the Product should be created.

    Format is
    `projects/PROJECT_ID/locations/LOC_ID`. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A Product contains ReferenceImages.
      "productLabels": [ # Key-value pairs that can be attached to a product. At query time,
          # constraints can be specified based on the product_labels.
          #
          # Note that integer values can be provided as strings, e.g. "1199". Only
          # strings with integer values can match a range-based restriction which is
          # to be supported soon.
          #
          # Multiple values can be assigned to the same key. One product may have up to
          # 100 product_labels.
        { # A product label represented as a key-value pair.
          "key": "A String", # The key of the label attached to the product. Cannot be empty and cannot
              # exceed 128 bytes.
          "value": "A String", # The value of the label attached to the product. Cannot be empty and
              # cannot exceed 128 bytes.
        },
      ],
      "displayName": "A String", # The user-provided name for this Product. Must not be empty. Must be at most
          # 4096 characters long.
      "name": "A String", # The resource name of the product.
          #
          # Format is:
          # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
          #
          # This field is ignored when creating a product.
      "productCategory": "A String", # The category for the product identified by the reference image. This should
          # be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories
          # "homegoods", "apparel", and "toys" are still supported, but these should
          # not be used for new products.
          #
          # This field is immutable.
      "description": "A String", # User-provided metadata to be stored with this product. Must be at most 4096
          # characters long.
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format
      productId: string, A user-supplied resource id for this Product. If set, the server will
    attempt to use this value as the resource id. If it is already in use, an
    error is returned with code ALREADY_EXISTS. Must be at most 128 characters
    long. It cannot contain the character `/`.

    Returns:
      An object of the form:

        { # A Product contains ReferenceImages.
        "productLabels": [ # Key-value pairs that can be attached to a product. At query time,
            # constraints can be specified based on the product_labels.
            #
            # Note that integer values can be provided as strings, e.g. "1199". Only
            # strings with integer values can match a range-based restriction which is
            # to be supported soon.
            #
            # Multiple values can be assigned to the same key. One product may have up to
            # 100 product_labels.
          { # A product label represented as a key-value pair.
            "key": "A String", # The key of the label attached to the product. Cannot be empty and cannot
                # exceed 128 bytes.
            "value": "A String", # The value of the label attached to the product. Cannot be empty and
                # cannot exceed 128 bytes.
          },
        ],
        "displayName": "A String", # The user-provided name for this Product. Must not be empty. Must be at most
            # 4096 characters long.
        "name": "A String", # The resource name of the product.
            #
            # Format is:
            # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
            #
            # This field is ignored when creating a product.
        "productCategory": "A String", # The category for the product identified by the reference image. This should
            # be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories
            # "homegoods", "apparel", and "toys" are still supported, but these should
            # not be used for new products.
            #
            # This field is immutable.
        "description": "A String", # User-provided metadata to be stored with this product. Must be at most 4096
            # characters long.
      }

`delete(name, x__xgafv=None)`

    Permanently deletes a product and its reference images.

    Metadata of the product and all its images will be deleted right away, but
    search queries against ProductSets containing the product may still work
    until all related caches are refreshed.

    Args:
      name: string, Resource name of product to delete.

    Format is:
    `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A generic empty message that you can re-use to avoid defining duplicated
          # empty messages in your APIs. A typical example is to use it as the request
          # or the response type of an API method. For instance:
          #
          #     service Foo {
          #       rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
          #     }
          #
          # The JSON representation for `Empty` is empty JSON object `{}`.
      }

`get(name, x__xgafv=None)`

    Gets information associated with a Product.

    Possible errors:

    * Returns NOT_FOUND if the Product does not exist.

    Args:
      name: string, Resource name of the Product to get.

    Format is:
    `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A Product contains ReferenceImages.
        "productLabels": [ # Key-value pairs that can be attached to a product. At query time,
            # constraints can be specified based on the product_labels.
            #
            # Note that integer values can be provided as strings, e.g. "1199". Only
            # strings with integer values can match a range-based restriction which is
            # to be supported soon.
            #
            # Multiple values can be assigned to the same key. One product may have up to
            # 100 product_labels.
          { # A product label represented as a key-value pair.
            "key": "A String", # The key of the label attached to the product. Cannot be empty and cannot
                # exceed 128 bytes.
            "value": "A String", # The value of the label attached to the product. Cannot be empty and
                # cannot exceed 128 bytes.
          },
        ],
        "displayName": "A String", # The user-provided name for this Product. Must not be empty. Must be at most
            # 4096 characters long.
        "name": "A String", # The resource name of the product.
            #
            # Format is:
            # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
            #
            # This field is ignored when creating a product.
        "productCategory": "A String", # The category for the product identified by the reference image. This should
            # be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories
            # "homegoods", "apparel", and "toys" are still supported, but these should
            # not be used for new products.
            #
            # This field is immutable.
        "description": "A String", # User-provided metadata to be stored with this product. Must be at most 4096
            # characters long.
      }

`list(parent, pageSize=None, pageToken=None, x__xgafv=None)`

    Lists products in an unspecified order.

    Possible errors:

    * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.

    Args:
      parent: string, The project OR ProductSet from which Products should be listed.

    Format:
    `projects/PROJECT_ID/locations/LOC_ID` (required)
      pageSize: integer, The maximum number of items to return. Default 10, maximum 100.
      pageToken: string, The next_page_token returned from a previous List request, if any.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # Response message for the `ListProducts` method.
        "nextPageToken": "A String", # Token to retrieve the next page of results, or empty if there are no more
            # results in the list.
        "products": [ # List of products.
          { # A Product contains ReferenceImages.
            "productLabels": [ # Key-value pairs that can be attached to a product. At query time,
                # constraints can be specified based on the product_labels.
                #
                # Note that integer values can be provided as strings, e.g. "1199". Only
                # strings with integer values can match a range-based restriction which is
                # to be supported soon.
                #
                # Multiple values can be assigned to the same key. One product may have up to
                # 100 product_labels.
              { # A product label represented as a key-value pair.
                "key": "A String", # The key of the label attached to the product. Cannot be empty and cannot
                    # exceed 128 bytes.
                "value": "A String", # The value of the label attached to the product. Cannot be empty and
                    # cannot exceed 128 bytes.
              },
            ],
            "displayName": "A String", # The user-provided name for this Product. Must not be empty. Must be at most
                # 4096 characters long.
            "name": "A String", # The resource name of the product.
                #
                # Format is:
                # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
                #
                # This field is ignored when creating a product.
            "productCategory": "A String", # The category for the product identified by the reference image. This should
                # be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories
                # "homegoods", "apparel", and "toys" are still supported, but these should
                # not be used for new products.
                #
                # This field is immutable.
            "description": "A String", # User-provided metadata to be stored with this product. Must be at most 4096
                # characters long.
          },
        ],
      }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.

`patch(name, body, updateMask=None, x__xgafv=None)`

    Makes changes to a Product resource.
    Only the `display_name`, `description`, and `labels` fields can be updated
    right now.

    If labels are updated, the change will not be reflected in queries until
    the next index time.

    Possible errors:

    * Returns NOT_FOUND if the Product does not exist.
    * Returns INVALID_ARGUMENT if display_name is present in update_mask but is
      missing from the request or longer than 4096 characters.
    * Returns INVALID_ARGUMENT if description is present in update_mask but is
      longer than 4096 characters.
    * Returns INVALID_ARGUMENT if product_category is present in update_mask.

    Args:
      name: string, The resource name of the product.

    Format is:
    `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.

    This field is ignored when creating a product. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A Product contains ReferenceImages.
      "productLabels": [ # Key-value pairs that can be attached to a product. At query time,
          # constraints can be specified based on the product_labels.
          #
          # Note that integer values can be provided as strings, e.g. "1199". Only
          # strings with integer values can match a range-based restriction which is
          # to be supported soon.
          #
          # Multiple values can be assigned to the same key. One product may have up to
          # 100 product_labels.
        { # A product label represented as a key-value pair.
          "key": "A String", # The key of the label attached to the product. Cannot be empty and cannot
              # exceed 128 bytes.
          "value": "A String", # The value of the label attached to the product. Cannot be empty and
              # cannot exceed 128 bytes.
        },
      ],
      "displayName": "A String", # The user-provided name for this Product. Must not be empty. Must be at most
          # 4096 characters long.
      "name": "A String", # The resource name of the product.
          #
          # Format is:
          # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
          #
          # This field is ignored when creating a product.
      "productCategory": "A String", # The category for the product identified by the reference image. This should
          # be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories
          # "homegoods", "apparel", and "toys" are still supported, but these should
          # not be used for new products.
          #
          # This field is immutable.
      "description": "A String", # User-provided metadata to be stored with this product. Must be at most 4096
          # characters long.
    }

      updateMask: string, The FieldMask that specifies which fields
    to update.
    If update_mask isn't specified, all mutable fields are to be updated.
    Valid mask paths include `product_labels`, `display_name`, and
    `description`.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A Product contains ReferenceImages.
        "productLabels": [ # Key-value pairs that can be attached to a product. At query time,
            # constraints can be specified based on the product_labels.
            #
            # Note that integer values can be provided as strings, e.g. "1199". Only
            # strings with integer values can match a range-based restriction which is
            # to be supported soon.
            #
            # Multiple values can be assigned to the same key. One product may have up to
            # 100 product_labels.
          { # A product label represented as a key-value pair.
            "key": "A String", # The key of the label attached to the product. Cannot be empty and cannot
                # exceed 128 bytes.
            "value": "A String", # The value of the label attached to the product. Cannot be empty and
                # cannot exceed 128 bytes.
          },
        ],
        "displayName": "A String", # The user-provided name for this Product. Must not be empty. Must be at most
            # 4096 characters long.
        "name": "A String", # The resource name of the product.
            #
            # Format is:
            # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
            #
            # This field is ignored when creating a product.
        "productCategory": "A String", # The category for the product identified by the reference image. This should
            # be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories
            # "homegoods", "apparel", and "toys" are still supported, but these should
            # not be used for new products.
            #
            # This field is immutable.
        "description": "A String", # User-provided metadata to be stored with this product. Must be at most 4096
            # characters long.
      }