Update Product Quantity Traceability
POST /api/v1/products/{productId}/update-quantity/traceability
Description
This endpoint allows updating the quantity of a specific product with traceability information. It is useful for maintaining accurate inventory records and ensuring that the traceability of products is properly documented.
URL Parameters:
productId(required): The unique identifier of the product whose quantity is being updated. This must be included in the URL path.
Headers:
userId(required): The user ID of the individual making the update. This header is used for authentication and authorization.tenantId(required): The tenant ID under which the product is registered. This header identifies the specific tenant environment and should be included.countryCode(optional): The country code related to the product or user making the request.
Request Body:
{
"quantity": 0,
"batches": [
{
"docLinks": [
{
"name": "SUSTAINABILITY",
"esgRequirement": "LABOR_PRACTICES",
"status": "NON_COMPLIANT",
"link": "string"
}
],
"localSeller": "string",
"addressId": "string",
"quantity": 0,
"weight": 0,
"unit": "Barrels",
"onloadingDate": "string",
"offloadDate": "string",
"offloadPersonnelPhone": "string",
"offloadPersonnelName": "string",
"testCoverage": false
}
],
"userId": "string"
}
Example Request
curl -X POST "http://[base_url]/api/v1/products/{productId}/update-quantity/traceability" \
-H "Authorization: Bearer [access_token]" \
-H "userId: USR123" \
-H "tenantId: TEN456" \
-H "countryCode: US" \
-d '{
"quantity": 100,
"batches": [
{
"docLinks": [
{
"name": "SUSTAINABILITY",
"esgRequirement": "LABOR_PRACTICES",
"status": "NON_COMPLIANT",
"link": "http://example.com/sustainability"
}
],
"localSeller": "LocalSellerName",
"addressId": "ADDR789",
"quantity": 100,
"weight": 1000,
"unit": "Barrels",
"onloadingDate": "2024-08-01",
"offloadDate": "2024-08-05",
"offloadPersonnelPhone": "+1234567890",
"offloadPersonnelName": "John Doe",
"testCoverage": true
}
],
"userId": "USR123"
}'
Responses:
201 Created: The product quantity and traceability information were successfully updated. The response typically includes a confirmation message and relevant details about the update.
Example Response
{
"message": "Product quantity and traceability information updated successfully.",
"productId": "12345"
}
Error Responses:
400 Bad Request: Incorrect parameters provided. 404 Not Found: No product found with the provided productId. 403 Forbidden: The user does not have permission to update the product quantity.