APIs & services / commons-report-service

Get land codes that were disabled on the server so the app can mark them disabled.

Endpointtoday's app
Call
GET /gateway/commons-report-service/api/v1/datasets/name/DisabledAssetCodeForCadre/execute
Service
commons-report-service
Features
Land assets
When
Home open, interval-gated
Auth
X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
In the App Service

Use case

FetchDisabledLandDataWorker runs from Home, limited by an interval (KEY_DISABLED_LAND_DATA_LAST_FETCH_TIME). It fetches land asset codes that were disabled on the server for the cadre's farmers and stores them as JSON in SharedPreferences. The land screens call AppUtils.checkIfLandHasBeenDisabled(assetCode) to mark those lands disabled. A failed response saves an empty list, and an exception fails the worker.

Headers

HeaderValueNotes
X-SESSIONID<session token>Passed explicitly as @Header from AndroidSessionManager.sessionId. AuthInterceptor still retries once with a fresh token on 401 or 400.

Parameters

ParamInRequiredExampleNotes
datasetNamepathYesDisabledAssetCodeForCadreDataset name in the path of commons-report-service /api/v1/datasets/name/{name}/execute.
versionqueryYes1Dataset version. Always 1.
formatqueryYesjsonResponse format. Always json, so the body is a JSON array of row objects.
paramsqueryYesCADRE_LOGIN=9XXXXXXXX1Dataset input parameters as KEY=value pairs joined with "--". CADRE_LOGIN = the user login before "@@" (cadre mobile/login id).

Request

No body. cadre params

Response

Example response body (synthetic data)
[
  {
    "IEID": "100001",
    "DisabledAssetCode": "LAND-0001",
    "is_active": "false",
    "inactive_reason": "Duplicate survey number",
    "id": "9001"
  }
]
FieldTypeRequiredNotes
IEIDstringFarmer the land belongs to; used to match against local farmer_assets.owningEntityId.
DisabledAssetCodestringAsset code to show as disabled (compared with farmer_assets.assetCode).
is_active, inactive_reason, idstringStored in the cached JSON; not read by the app.

Errors

StatusWhenWhat the app does
401 / 400Session token expired or rejectedAuthInterceptor refreshes the token and retries once; if the retry also fails, Non-2xx: an empty list is cached (no lands shown as disabled). Exception: Result.failure(), cache unchanged.
5xxDataset query failed on the serverNon-2xx: an empty list is cached (no lands shown as disabled). Exception: Result.failure(), cache unchanged.
network errorNo connectivity or timeoutNon-2xx: an empty list is cached (no lands shown as disabled). Exception: Result.failure(), cache unchanged.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/service/FetchDisabledLandDataWorker.kt
  • app/src/main/java/org/platformcommons/urvi/utility/AppUtils.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/network/responsedto/DisabledLandDto.kt