APIs & services / Reporting datasets (rtld)

Load endorsements across the VO hierarchy for the VO tab.

Endpointtoday's app
Call
GET /rtld/api/dataset/v1/execute?name=PlusOneEndorsementVOHierarchy
Service
Reporting datasets (rtld)
Features
VO / SHG / Farmer endorsement
When
User opens VO tab
Auth
X-SESSIONID set by CoreAPI (dooNowOrThrow)
In the App Service

Use case

Loads all endorsements in the user's VO hierarchy. It runs from the side drawer (BottomNavigationDrawerFragment) and the farmer list (IeFragment) via EndorsementRepositoryImpl.getEndorsementForVo, only when the user has VO work nodes. Rows older than the configured endorsement start date are dropped. The rest update endorsement status on ie_flat_entity (VO, SHG or farmer level) and are saved to the endorsement table. Errors are logged and returned as Resource.error.

Headers

HeaderValueNotes
X-SESSIONID<session token>Not set by the call site. AuthInterceptor (OkHttpClientInterceptor) adds it from AndroidSessionManager. On a 401 or 400 it invalidates the token, gets a fresh one and retries once.

Parameters

ParamInRequiredExampleNotes
namequeryYesPlusOneEndorsementVOHierarchyDataset name. The rtld executor (/rtld/api/dataset/v1/execute) picks the dataset by this query param.
versionqueryYes1Dataset version. Always 1.
formatqueryYesjsonResponse format. Always json, so the body is a JSON array of row objects.
paramsqueryYesVO_CODE=VO-ALIAS-001Dataset input parameters as KEY=value pairs joined with "--". VO_CODE = SharedPrefSource.workNodeDetail.voAliasId (the VO the user works in).

Request

No body. VO params

Response

Example response body (synthetic data)
[
  {
    "id": 8001,
    "unique_identifier": "end-uuid-0001",
    "entity_type": "ENTITY_TYPE.SHG",
    "entity_id": "SHG-ALIAS-001",
    "entity_code": "SHG-ALIAS-001",
    "name": "SHG A",
    "status": "ENDORSED",
    "endorsement_type": "MONTHLY",
    "endorsed_by": "Reviewer A",
    "endorsed_user_id": 2002,
    "created_at": 1719792000000,
    "last_modified_at": 1719792000000,
    "year_month_endorsement": "1719792000000",
    "shg_code": "SHG-ALIAS-001",
    "shg_name": "SHG A",
    "vo_code": "VO-ALIAS-001",
    "vo_name": "VO A",
    "mandal_code": "M01",
    "mandal_name": "Mandal A",
    "district_name": "District A",
    "has_npm_shop": false,
    "review_by_user_id": null,
    "reviewd_by": null,
    "unit_name": null,
    "is_active": true,
    "tenant_id": 11
  }
]
FieldTypeRequiredNotes
entity_typestringVO / SHG / farmer; picks which ie_flat_entity endorsement columns to update.
entity_idstringId of the VO, SHG or farmer being endorsed.
status, endorsed_by, created_atstring, string, longWritten to ie_flat_entity.endorsementStatus / endorsedBy / endorsedTime; created_at is also used for the start-date filter.
id, unique_identifierint, stringEndorsementEntity.id / uuid.
entity_code, name, endorsement_type, endorsed_user_id, year_month_endorsement, shg_code, shg_name, vo_code, vo_name, mandal_code, mandal_name, district_name, has_npm_shop, review_by_user_id, reviewd_by, unit_namevariousCopied into the endorsement table (year_month_endorsement -> timestamp).
app_*, created_by*, last_modified_*, inactive_*, is_active, tenant_idvariousAudit fields; parsed, not read.

Errors

StatusWhenWhat the app does
401 / 400Session token expired or rejectedAuthInterceptor refreshes the token and retries once; if the retry also fails, Resource.error with the error body; local endorsements unchanged.
5xxDataset query failed on the serverResource.error with the error body; local endorsements unchanged.
network errorNo connectivity or timeoutResource.error with the error body; local endorsements unchanged.
200 emptyNo endorsementsClears the VO endorsement fields for that VO.

Source

  • data/src/main/java/org/mindtree/app/agricultor/data/setup_new/SetupServiceNew.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/EndorsementRepositoryImpl.kt
  • app/src/main/java/org/platformcommons/urvi/view/home/BottomNavigationDrawerFragment.kt
  • app/src/main/java/org/platformcommons/urvi/view/ie/IeFragment.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/net/EndorsementResponseDtoItem.kt