Update Product Details
PATCH /api/v1/products/{productId}
Description
Updates the details of an existing product, such as its name, price, quantity, and description. This endpoint allows for comprehensive management of product information, ensuring that data is current and aligned with business operations and market needs.
URL Parameters:
productId(required): The unique identifier of the product to be updated. This must be included in the URL path.
Headers:
tenantId(required): The tenant ID under which the product is registered. This should be included as a header.userId(required): The user ID of the individual responsible for updating the product. This should also be included as a header.countryCode(required): The country code where the product is registered or being sold. This should be included as a header.
Request Body (application/json): Required. The body should include updated information about the product:
{
"name": "string",
"state": "string",
"city": "string",
"photos": [
"string"
],
"description": "string",
"quantity": 0,
"costPrice": 0,
"sellingPrice": 0,
"currencyCode": "string",
"businessId": "string",
"userId": "string",
"tenantId": "string",
"countryCode": "string",
"productTypeId": "string",
"productTypeDetail": {}
}
Example Request:
curl -X PATCH "http://[base_url]/api/v1/products/{productId}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [access_token]" \
-H "tenantId: TEN123" \
-H "userId: USR456" \
-H "countryCode: US" \
-d '{
"name": "Updated Organic Apples",
"state": "California",
"city": "San Francisco",
"photos": ["http://example.com/newphoto.jpg"],
"description": "Updated description of fresh organic apples from sustainable orchards.",
"quantity": 150,
"costPrice": 0.55,
"sellingPrice": 1.10,
"currencyCode": "USD",
"businessId": "BIZ789",
"userId": "USR456",
"tenantId": "TEN123",
"countryCode": "US",
"productTypeId": "123",
"productTypeDetail": {
"size": "Medium",
"packaging": "Box"
}
}'
Responses:
- 200 OK: Successfully updated the product details. The response typically includes a confirmation of the changes made.
Example Response:
{
"message": "Product updated successfully."
}
Error Responses:
- 400 Bad Request: Incorrect or incomplete data provided for the update.
- 404 Not Found: No product found with the provided
productId. - 403 Forbidden: The user does not have permission to update the product.
LANGUAGE
CURL REQUEST
curl --request PATCH \
--url /api/v1/products/{productId} \
--header 'accept: application/json' \
--header 'content-type: application/json'
RESPONSE
Click Try It! to start a request and see the response here!