APIs & services / Common TLD (ctld)

Upload a farmer profile photo.

Endpointtoday's app
Call
PUT /ctld/api/ie/v1/iconpic
Service
Common TLD (ctld)
Features
Add/Edit farmer (IE profile)
When
Queued sync (IE_ICONPIC PUT) after user sets a photo
Auth
X-SESSIONID stamped when queued (CoreAPI dooWithRetry); X-REQUESTID idempotency key
In the App Service

Use case

Queued multipart upload of the farmer profile photo (IE_ICONPIC PUT via IEIconpicWorker) after the user sets a photo on the farmer profile. It depends on the farmer create op so the server IE id is known. The response is not read; success just closes the ledger entry. Failures retry from the queue.

Headers

HeaderValueNotes
X-SESSIONID<session token>Stamped when queued (dooWithRetry); refreshed on 401.
X-ACK-REQUESTID<X-REQUESTID of an earlier completed op>Added by SyncQueueProcessor for POST/PUT. X-REQUESTID is removed for multipart requests by CoreAPIDefaultImpl.processOperation.
Content-Typemultipart/form-data; boundary=<generated>Multipart because the op has a File param.

Request

Example request body (synthetic data)
{
  "file": "<multipart part: farmer photo .jpg>",
  "id": "40001"
}
FieldTypeRequiredNotes
filebinary (image)YesLocal photo file of the farmer.
idstring (form field)YesServer IE id.

Response

FieldTypeRequiredNotes
(body)unknownNot read by the app.

Errors

StatusWhenWhat the app does
401Session token expired or invalidCoreAPI invalidates the session id and retries once immediately; if still failing the op stays in the queue (TryAgain.LATER).
500Server error on a /gateway URLBaseResponseHandler fetches a new session id (first 5 attempts) and returns TryAgain.LATER; retried per RetryScheduler policy (retry threshold/delay come from app config).
503Service unavailableCoreAPI retries once immediately, then the op is retried later by the sync queue.
any non-2xxAny other failureHandler onError -> TryAgain.LATER (op stays queued and is visible in Pending Sync); a row is written to the local error_log table (Sync Error Log screen) with URL, body, headers and raw response; every 10th attempt the op is mirrored to Firestore for support.

Source

  • data/src/main/java/org/mindtree/app/agricultor/data/entity/IE.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/work/IEIconpicWorker.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/IEIconPicRH.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/manager/CoreAPIManager.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/BaseResponseHandler.kt
  • offline-core/src/main/java/com/mindtree/bridge/coreapi/offline/SyncQueueProcessor.java
  • offline-core/src/main/java/com/mindtree/bridge/coreapi/offline/manager/OperationManagerImpl.java
  • core-api/src/main/java/com/mindtree/bridge/coreapi/impl/CoreAPIDefaultImpl.java