Required. The ID to use for theProduct, which will become the final component of theProduct.name. If the caller does not have permission to create theProduct, regardless of whether or not it exists, a PERMISSION_DENIED error is returned. This field must be unique among allProducts with the sameparent. Otherwise, an ALREADY_EXISTS error is returned. This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.
getParent
Required. The parent catalog resource name, such asprojects/*/locations/global/catalogs/default_catalog/branches/default_branch.
Returns
Type
Description
string
setParent
Required. The parent catalog resource name, such asprojects/*/locations/global/catalogs/default_catalog/branches/default_branch.
Required. The ID to use for theProduct,
which will become the final component of theProduct.name.
If the caller does not have permission to create theProduct, regardless of whether or not it
exists, a PERMISSION_DENIED error is returned.
This field must be unique among allProducts with the sameparent. Otherwise, an
ALREADY_EXISTS error is returned.
This field must be a UTF-8 encoded string with a length limit of 128
characters. Otherwise, an INVALID_ARGUMENT error is returned.
Returns
Type
Description
string
setProductId
Required. The ID to use for theProduct,
which will become the final component of theProduct.name.
If the caller does not have permission to create theProduct, regardless of whether or not it
exists, a PERMISSION_DENIED error is returned.
This field must be unique among allProducts with the sameparent. Otherwise, an
ALREADY_EXISTS error is returned.
This field must be a UTF-8 encoded string with a length limit of 128
characters. Otherwise, an INVALID_ARGUMENT error is returned.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
static::build
Parameters
Name
Description
parent
string
Required. The parent catalog resource name, such asprojects/*/locations/global/catalogs/default_catalog/branches/default_branch. Please seeProductServiceClient::branchName()for help formatting this field.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Retail V2 Client - Class CreateProductRequest (2.3.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.3.1 (latest)](/php/docs/reference/cloud-retail/latest/V2.CreateProductRequest)\n- [2.3.0](/php/docs/reference/cloud-retail/2.3.0/V2.CreateProductRequest)\n- [2.2.1](/php/docs/reference/cloud-retail/2.2.1/V2.CreateProductRequest)\n- [2.1.3](/php/docs/reference/cloud-retail/2.1.3/V2.CreateProductRequest)\n- [2.0.0](/php/docs/reference/cloud-retail/2.0.0/V2.CreateProductRequest)\n- [1.7.0](/php/docs/reference/cloud-retail/1.7.0/V2.CreateProductRequest)\n- [1.6.4](/php/docs/reference/cloud-retail/1.6.4/V2.CreateProductRequest)\n- [1.5.0](/php/docs/reference/cloud-retail/1.5.0/V2.CreateProductRequest)\n- [1.4.2](/php/docs/reference/cloud-retail/1.4.2/V2.CreateProductRequest)\n- [1.3.1](/php/docs/reference/cloud-retail/1.3.1/V2.CreateProductRequest)\n- [1.2.1](/php/docs/reference/cloud-retail/1.2.1/V2.CreateProductRequest)\n- [1.1.1](/php/docs/reference/cloud-retail/1.1.1/V2.CreateProductRequest)\n- [1.0.1](/php/docs/reference/cloud-retail/1.0.1/V2.CreateProductRequest) \nReference documentation and code samples for the Google Cloud Retail V2 Client class CreateProductRequest.\n\nRequest message for\n[ProductService.CreateProduct](/php/docs/reference/cloud-retail/latest/V2.Client.ProductServiceClient#_Google_Cloud_Retail_V2_Client_ProductServiceClient__createProduct__)\nmethod.\n\nGenerated from protobuf message `google.cloud.retail.v2.CreateProductRequest`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Retail \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getParent\n\nRequired. The parent catalog resource name, such as\n`projects/*/locations/global/catalogs/default_catalog/branches/default_branch`.\n\n### setParent\n\nRequired. The parent catalog resource name, such as\n`projects/*/locations/global/catalogs/default_catalog/branches/default_branch`.\n\n### getProduct\n\nRequired. The [Product](/php/docs/reference/cloud-retail/latest/V2.Product) to create.\n\n### hasProduct\n\n### clearProduct\n\n### setProduct\n\nRequired. The [Product](/php/docs/reference/cloud-retail/latest/V2.Product) to create.\n\n### getProductId\n\nRequired. The ID to use for the [Product](/php/docs/reference/cloud-retail/latest/V2.Product),\nwhich will become the final component of the\n[Product.name](/php/docs/reference/cloud-retail/latest/V2.Product#_Google_Cloud_Retail_V2_Product__getName__).\n\nIf the caller does not have permission to create the\n[Product](/php/docs/reference/cloud-retail/latest/V2.Product), regardless of whether or not it\nexists, a PERMISSION_DENIED error is returned.\nThis field must be unique among all\n[Product](/php/docs/reference/cloud-retail/latest/V2.Product)s with the same\n[parent](/php/docs/reference/cloud-retail/latest/V2.CreateProductRequest#_Google_Cloud_Retail_V2_CreateProductRequest__getParent__). Otherwise, an\nALREADY_EXISTS error is returned.\nThis field must be a UTF-8 encoded string with a length limit of 128\ncharacters. Otherwise, an INVALID_ARGUMENT error is returned.\n\n### setProductId\n\nRequired. The ID to use for the [Product](/php/docs/reference/cloud-retail/latest/V2.Product),\nwhich will become the final component of the\n[Product.name](/php/docs/reference/cloud-retail/latest/V2.Product#_Google_Cloud_Retail_V2_Product__getName__).\n\nIf the caller does not have permission to create the\n[Product](/php/docs/reference/cloud-retail/latest/V2.Product), regardless of whether or not it\nexists, a PERMISSION_DENIED error is returned.\nThis field must be unique among all\n[Product](/php/docs/reference/cloud-retail/latest/V2.Product)s with the same\n[parent](/php/docs/reference/cloud-retail/latest/V2.CreateProductRequest#_Google_Cloud_Retail_V2_CreateProductRequest__getParent__). Otherwise, an\nALREADY_EXISTS error is returned.\nThis field must be a UTF-8 encoded string with a length limit of 128\ncharacters. Otherwise, an INVALID_ARGUMENT error is returned.\n\n### static::build"]]