Skip to content

[Merchant products API] Update product with mask #8911

@jbaelo

Description

@jbaelo

Environment details

  • OS: Linux
  • PHP version: 8.5
  • Package name and version: google/shopping-merchant-products : 1.3.1

Steps to reproduce

Update product customLabel0 on supplemetary feed with FieldMask. The protobuf sends bad query params on update mask

Code example

        $attributes = new ProductAttributes()
            ->setCustomLabel0("Some value");
        $productInput = new ProductInput()
            ->setName("accounts/{{accountId}}/productInputs/{{productId}}")
            ->setProductAttributes($attributes);

        $updateMask = new FieldMask()
            ->setPaths(['product_attributes.custom_label_0']);

        $request = new UpdateProductInputRequest()
            ->setDataSource("accounts{{accountId}}/dataSources/{{dataSourceId}}")
            ->setProductInput($productInput)
            ->setUpdateMask($updateMask);

        $client->updateProductInput($request);

We get this error

{                                                                            
      "reason": "invalid",                                                     
      "domain": "merchantapi.googleapis.com",                                  
      "errorInfoMetadata": {                                                   
          "FIELD_LOCATION": "updateMask.paths[0]",                             
          "PATHS": "[product_attributes.custom_label0]",                       
          "REASON": "INVALID_FIELD_MASK_PATH"                                  
      },                                                                       
      "message": "[updateMask.paths[0]] Invalid field paths: [product_attribu  
  tes.custom_label0]",                                                         
      "code": 3,                                                               
      "status": "INVALID_ARGUMENT",                                            
      "details": [                                                             
          {                                                                    
              "@type": "type.googleapis.com\/google.rpc.ErrorInfo",            
              "reason": "invalid",                                             
              "domain": "merchantapi.googleapis.com",                          
              "metadata": {                                                    
                  "FIELD_LOCATION": "updateMask.paths[0]",                     
                  "PATHS": "[product_attributes.custom_label0]",               
                  "REASON": "INVALID_FIELD_MASK_PATH"                          
              }                                                                
          }                                                                    
      ]                                                                        
  }  

Lib should send product_attributes.custom_label_0 on query param updateMask

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions