APIs & services / Common TLD (ctld)

Remove a farmer role.

Endpointtoday's app
Call
DELETE /ctld/api/ierolemap/v1?iERoleMapId=
Service
Common TLD (ctld)
Features
Add/Edit farmer (IE profile)
When
Queued sync (IE_ROLE_MAP DELETE)
Auth
X-SESSIONID stamped when queued (CoreAPI dooWithRetry); X-REQUESTID idempotency key
In the App Service

Use case

Queued removal of a farmer role (IE_ROLE_MAP DELETE) when a role is unticked on the farmer form. On success the local ierolemap row is deleted. On error the handler re-reads the server id from the DB, updates the iERoleMapId query param and retries later.

Headers

HeaderValueNotes
X-SESSIONID<session token>Stamped when queued (dooWithRetry); refreshed on 401.
Content-Typeapplication/jsonAdded by CoreAPI even though there is no body. No X-REQUESTID: DELETE ops do not get one.

Parameters

ParamInRequiredExampleNotes
iERoleMapIdqueryYes801Server role map id (patched on retry if it was 0).

Request

No body. iERoleMapId

Response

FieldTypeRequiredNotes
(body)unknownNot read.

Errors

StatusWhenWhat the app does
any (body contains 'already deactivated')Role already removed on serverReturns the handler's TryAgain (LATER) - the op is not auto-completed.
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/IERoleMap.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/work/IERoleMapWorker.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/IERoleMapDeleteRH.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