# Update Product Reviews

PUT https://services.leadconnectorhq.com/products/reviews/{reviewId}

Update status, reply, etc of a particular review

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `products.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `reviewId` | string | Yes | Review Id |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/products/reviews/{reviewId}": {
      "put": {
        "summary": "Update Product Reviews",
        "operationId": "updateProductReviews",
        "description": "Update status, reply, etc of a particular review",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "reviewId",
            "required": true,
            "in": "path",
            "description": "Review Id",
            "schema": {
              "example": "6578278e879ad2646715ba9c",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProductReviewDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateProductReviewsResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": [
              "products.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "UpdateProductReviewDto": {
        "type": "object",
        "properties": {
          "altId": {
            "type": "string",
            "description": "Location Id or Agency Id",
            "example": "6578278e879ad2646715ba9c"
          },
          "altType": {
            "type": "string",
            "enum": [
              "location"
            ]
          },
          "productId": {
            "type": "string",
            "description": "Product Id",
            "example": "6578278e879ad2646715ba9c"
          },
          "status": {
            "type": "string",
            "description": "Status of the review",
            "example": "approved"
          },
          "reply": {
            "description": "Reply of the review",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "headline": {
                  "type": "string",
                  "description": "Headline of the Review",
                  "example": "Amazing product with great quality",
                  "minLength": 0,
                  "maxLength": 200
                },
                "comment": {
                  "type": "string",
                  "description": "Detailed Review of the product",
                  "example": "This product exceeded my expectations in terms of quality and performance. Highly recommended!",
                  "minLength": 0,
                  "maxLength": 5000
                },
                "user": {
                  "description": "User who is giving the review/reply",
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Name of the customer",
                          "example": "John Doe",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "email": {
                          "type": "string",
                          "description": "Email of the customer",
                          "example": "example@example.com"
                        },
                        "phone": {
                          "type": "string",
                          "description": "Phone no of the customer",
                          "example": "+1-555-555-5555"
                        },
                        "isCustomer": {
                          "type": "boolean",
                          "description": "Is the person an admin or customer",
                          "example": true
                        }
                      },
                      "required": [
                        "name",
                        "email"
                      ],
                      "title": "UserDetailsDto"
                    }
                  ]
                }
              },
              "required": [
                "headline",
                "comment",
                "user"
              ],
              "title": "ProductReviewDto"
            }
          },
          "rating": {
            "type": "number",
            "description": "Rating of the product",
            "example": "4.5"
          },
          "headline": {
            "type": "string",
            "description": "Headline of the Review",
            "example": "Amazing product with great quality"
          },
          "detail": {
            "type": "string",
            "description": "Detailed Review of the product",
            "example": "The product is for sure a must and recommended buy"
          }
        },
        "required": [
          "altId",
          "altType",
          "productId",
          "status"
        ],
        "title": "UpdateProductReviewDto"
      },
      "UpdateProductReviewsResponseDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "boolean",
            "description": "Status of api action",
            "example": true
          },
          "message": {
            "type": "string",
            "description": "Success message",
            "example": "Successfully created"
          }
        },
        "required": [
          "status"
        ],
        "title": "UpdateProductReviewsResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## HighLevel SDK Examples

**Node.js** (`@gohighlevel/api-client`)

```javascript
import HighLevel from '@gohighlevel/api-client';

const ghl = new HighLevel({
  privateIntegrationToken: '<PRIVATE_INTEGRATION_TOKEN>'
});

const body = {
  "altId": "6578278e879ad2646715ba9c",
  "productId": "6578278e879ad2646715ba9c",
  "status": "approved",
  "reply": [
    {
      "headline": "Amazing product with great quality",
      "comment": "This product exceeded my expectations in terms of quality and performance. Highly recommended!",
      "user": {
        "name": "John Doe",
        "email": "example@example.com",
        "phone": "+1-555-555-5555",
        "isCustomer": true
      }
    }
  ],
  "rating": "4.5",
  "headline": "Amazing product with great quality",
  "detail": "The product is for sure a must and recommended buy"
};

const response = await ghl.products.updateProductReviews('<REVIEWID>', body);
console.log(response);
```

**Python** (`gohighlevel-api-client`)

```python
from highlevel import HighLevel

client = HighLevel(
    private_integration_token='<PRIVATE_INTEGRATION_TOKEN>'
)

body = {
    "altId": "6578278e879ad2646715ba9c",
    "productId": "6578278e879ad2646715ba9c",
    "status": "approved",
    "reply": [
        {
            "headline": "Amazing product with great quality",
            "comment": "This product exceeded my expectations in terms of quality and performance. Highly recommended!",
            "user": {
                "name": "John Doe",
                "email": "example@example.com",
                "phone": "+1-555-555-5555",
                "isCustomer": true
            }
        }
    ],
    "rating": "4.5",
    "headline": "Amazing product with great quality",
    "detail": "The product is for sure a must and recommended buy"
}

response = await client.products.update_product_reviews('<REVIEWID>', body=body)
print(response)
```

**PHP** (`gohighlevel/api-client`)

```php
<?php
require_once 'vendor/autoload.php';

use HighLevel\HighLevel;
use HighLevel\HighLevelConfig;

$config = new HighLevelConfig([
    'privateIntegrationToken' => '<PRIVATE_INTEGRATION_TOKEN>'
]);
$ghl = new HighLevel($config);

$body = [
    'altId' => '6578278e879ad2646715ba9c',
    'productId' => '6578278e879ad2646715ba9c',
    'status' => 'approved',
    'reply' => [
        [
            'headline' => 'Amazing product with great quality',
            'comment' => 'This product exceeded my expectations in terms of quality and performance. Highly recommended!',
            'user' => [
                'name' => 'John Doe',
                'email' => 'example@example.com',
                'phone' => '+1-555-555-5555',
                'isCustomer' => true
            ]
        ]
    ],
    'rating' => '4.5',
    'headline' => 'Amazing product with great quality',
    'detail' => 'The product is for sure a must and recommended buy'
];

$response = $ghl->products->updateProductReviews('<REVIEWID>', $body);
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X PUT 'https://services.leadconnectorhq.com/products/reviews/<reviewId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "altId": "6578278e879ad2646715ba9c",
  "productId": "6578278e879ad2646715ba9c",
  "status": "approved",
  "reply": [
    {
      "headline": "Amazing product with great quality",
      "comment": "This product exceeded my expectations in terms of quality and performance. Highly recommended!",
      "user": {
        "name": "John Doe",
        "email": "example@example.com",
        "phone": "+1-555-555-5555",
        "isCustomer": true
      }
    }
  ],
  "rating": "4.5",
  "headline": "Amazing product with great quality",
  "detail": "The product is for sure a must and recommended buy"
}'
```

**Node.js**

```javascript
const options = {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "altId": "6578278e879ad2646715ba9c",
      "productId": "6578278e879ad2646715ba9c",
      "status": "approved",
      "reply": [
        {
          "headline": "Amazing product with great quality",
          "comment": "This product exceeded my expectations in terms of quality and performance. Highly recommended!",
          "user": {
            "name": "John Doe",
            "email": "example@example.com",
            "phone": "+1-555-555-5555",
            "isCustomer": true
          }
        }
      ],
      "rating": "4.5",
      "headline": "Amazing product with great quality",
      "detail": "The product is for sure a must and recommended buy"
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/products/reviews/<reviewId>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/products/reviews/{reviewId}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

payload = {
    "altId": "6578278e879ad2646715ba9c",
    "productId": "6578278e879ad2646715ba9c",
    "status": "approved",
    "reply": [
        {
            "headline": "Amazing product with great quality",
            "comment": "This product exceeded my expectations in terms of quality and performance. Highly recommended!",
            "user": {
                "name": "John Doe",
                "email": "example@example.com",
                "phone": "+1-555-555-5555",
                "isCustomer": true
            }
        }
    ],
    "rating": "4.5",
    "headline": "Amazing product with great quality",
    "detail": "The product is for sure a must and recommended buy"
}

response = requests.put(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/products/reviews/<reviewId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "altId": "6578278e879ad2646715ba9c",
  "productId": "6578278e879ad2646715ba9c",
  "status": "approved",
  "reply": [
    {
      "headline": "Amazing product with great quality",
      "comment": "This product exceeded my expectations in terms of quality and performance. Highly recommended!",
      "user": {
        "name": "John Doe",
        "email": "example@example.com",
        "phone": "+1-555-555-5555",
        "isCustomer": true
      }
    }
  ],
  "rating": "4.5",
  "headline": "Amazing product with great quality",
  "detail": "The product is for sure a must and recommended buy"
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .put("https://services.leadconnectorhq.com/products/reviews/<reviewId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"altId\":\"6578278e879ad2646715ba9c\",\"productId\":\"6578278e879ad2646715ba9c\",\"status\":\"approved\",\"reply\":[{\"headline\":\"Amazing product with great quality\",\"comment\":\"This product exceeded my expectations in terms of quality and performance. Highly recommended!\",\"user\":{\"name\":\"John Doe\",\"email\":\"example@example.com\",\"phone\":\"+1-555-555-5555\",\"isCustomer\":true}}],\"rating\":\"4.5\",\"headline\":\"Amazing product with great quality\",\"detail\":\"The product is for sure a must and recommended buy\"}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/products/reviews/<reviewId>"
  payload := strings.NewReader(`{
  "altId": "6578278e879ad2646715ba9c",
  "productId": "6578278e879ad2646715ba9c",
  "status": "approved",
  "reply": [
    {
      "headline": "Amazing product with great quality",
      "comment": "This product exceeded my expectations in terms of quality and performance. Highly recommended!",
      "user": {
        "name": "John Doe",
        "email": "example@example.com",
        "phone": "+1-555-555-5555",
        "isCustomer": true
      }
    }
  ],
  "rating": "4.5",
  "headline": "Amazing product with great quality",
  "detail": "The product is for sure a must and recommended buy"
}`)
  req, _ := http.NewRequest("PUT", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/products/reviews/<reviewId>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "altId": "6578278e879ad2646715ba9c",
  "productId": "6578278e879ad2646715ba9c",
  "status": "approved",
  "reply": [
    {
      "headline": "Amazing product with great quality",
      "comment": "This product exceeded my expectations in terms of quality and performance. Highly recommended!",
      "user": {
        "name": "John Doe",
        "email": "example@example.com",
        "phone": "+1-555-555-5555",
        "isCustomer": true
      }
    }
  ],
  "rating": "4.5",
  "headline": "Amazing product with great quality",
  "detail": "The product is for sure a must and recommended buy"
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$body = '{
  "altId": "6578278e879ad2646715ba9c",
  "productId": "6578278e879ad2646715ba9c",
  "status": "approved",
  "reply": [
    {
      "headline": "Amazing product with great quality",
      "comment": "This product exceeded my expectations in terms of quality and performance. Highly recommended!",
      "user": {
        "name": "John Doe",
        "email": "example@example.com",
        "phone": "+1-555-555-5555",
        "isCustomer": true
      }
    }
  ],
  "rating": "4.5",
  "headline": "Amazing product with great quality",
  "detail": "The product is for sure a must and recommended buy"
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/products/reviews/<reviewId>' -Method 'PUT' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
