Update Trade Details
PATCH /api/v1/trades/{tradeId}
Description
Updates the details of an existing trade, such as product details, quantities, pricing, documentation, and specific requirements related to labeling and packaging. This endpoint is crucial for managing ongoing trades and ensuring the accuracy and relevance of trade data.
URL Parameters:
tradeId(required): The unique identifier of the trade to be updated. This must be included in the URL path.
Headers:
tenantId(required): The tenant ID under which the trade is registered. This should be included as a header.userId(required): The user ID of the individual responsible for updating the trade. This should also be included as a header.countryCode(required): The country code where the trade is being processed. This should be included as a header.
Request Body (application/json): Required. The body should include updated information about the trade:
{
"productId": "string",
"description": "string",
"quantity": 0,
"indicativeUnitPrice": 0,
"totalAmount": 0,
"productUnitType": "Barrels",
"docLinks": [
{
"name": "string",
"link": "string"
}
],
"labellingRequirement": "string",
"packagingRequirement": "string",
"userId": "string",
"tenantId": "string",
"countryCode": "string"
}
Example Request:
curl -X PATCH "http://[base_url]/api/v1/trades/{tradeId}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [access_token]" \
-H "tenantId: TEN123" \
-H "userId: USR456" \
-H "countryCode: US" \
-d '{
"productId": "newProd123",
"description": "Updated quality crude oil",
"quantity": 1500,
"indicativeUnitPrice": 55,
"totalAmount": 82500,
"productUnitType": "Barrels",
"docLinks": [
{
"name": "Updated Contract",
"link": "http://example.com/updated-contract.pdf"
}
],
"labellingRequirement": "Updated Hazardous Material",
"packagingRequirement": "Updated Reinforced Steel Drums",
"userId": "USR456",
"tenantId": "TEN123",
"countryCode": "US"
}'
Responses:
- 200 OK: Successfully updated the trade details. The response typically includes a confirmation of the changes made.
Example Response:
{
"message": "Trade updated successfully."
}
Error Responses:
- 400 Bad Request: Incorrect or incomplete data provided for the update.
- 404 Not Found: No trade found with the provided
tradeId. - 403 Forbidden: The user does not have permission to update the trade.
LANGUAGE
CURL REQUEST
curl --request PATCH \
--url /api/v1/trades/{tradeId} \
--header 'accept: application/json' \
--header 'content-type: application/json'
RESPONSE
Click Try It! to start a request and see the response here!