Skip to main content

Upload Single Farmer Batch Document

POST /api/v1/trades/{tradeId}/farmer/{farmerId}/batch/single/upload

Description

This endpoint facilitates the uploading of a single batch document related to a specific farmer within a trade. It's used to provide documentation that verifies the details of a particular batch, such as quality checks, certification, or other relevant data necessary for compliance and tracking purposes.

URL Parameters:

  • tradeId (required): The unique identifier of the trade associated with the document upload.
  • farmerId (required): The unique identifier of the farmer for whom the batch document is being uploaded.

Headers:

  • countryCode (required): The country code where the trade is taking place. This should be included as a header.
  • userId (required): The user ID of the individual responsible for uploading the document.
  • tenantId (required): The tenant ID under which the document is being uploaded.

Request Body (application/json): Required. The body should include the document link and identifiers related to the user and tenant:

{
"docLink": "string",
"userId": "string",
"tenantId": "string",
"countryCode": "string"
}

Example Request:

curl -X POST "http://[base_url]/api/v1/trades/{tradeId}/farmer/{farmerId}/batch/single/upload" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [access_token]" \
-H "countryCode: US" \
-H "userId: USR123" \
-H "tenantId: TEN123" \
-d '{
"docLink": "http://example.com/path/to/document.pdf",
"userId": "USR123",
"tenantId": "TEN123",
"countryCode": "US"
}'

Responses:

  • 201 Created: Indicates that the document has been successfully uploaded for the batch. The response typically includes confirmation that the document has been recorded and a reference to the uploaded document.

Example Response:

{
"message": "Document uploaded successfully.",
"documentId": "doc123"
}

Error Responses:

  • 400 Bad Request: Incorrect or incomplete data for the document upload.
  • 404 Not Found: No trade or farmer found with the provided IDs.
  • 403 Forbidden: The user does not have permission to upload documents for the farmer or trade.

LANGUAGE

AUTHORIZATION

Bearer

CURL REQUEST


curl --request POST \ 
--url /api/v1/trades/{tradeId}/farmer/{farmerId}/batch/single/upload \
--header 'accept: application/json' \
--header 'content-type: application/json'

RESPONSE


Click Try It! to start a request and see the response here!