APIs & services / commons-report-service

List districts. Same call duplicated in three client classes.

Endpointtoday's app
Call
GET /gateway/commons-report-service/api/v1/datasets/name/PlusOneGetAllDistricts/execute
Service
commons-report-service
Features
VO geographic filter (FCCC), Leased land
When
User drills down a geography filter
Auth
X-SESSIONID set by CoreAPI (dooNowOrThrow)
In the App Service

Use case

First level of the geography drill-down. EndorsementFragment uses it (via EndorsementRepositoryImpl) for the VO endorsement geo filter, and AddUpdateAssetNewDialog uses it (via VoFilterRepoImpl) to find the other farmer in a land lease. Results fill the district dropdown; errors leave it empty.

Headers

HeaderValueNotes
X-SESSIONID<session token>Added by Bridge CoreAPI from the AccountManager session when the Operation is executed with dooNowOrThrow. The app code does not set it.

Parameters

ParamInRequiredExampleNotes
datasetNamepathYesPlusOneGetAllDistrictsDataset 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.
paramsqueryNoNot sent; the dataset takes no input.

Request

No body.

Response

Example response body (synthetic data)
[
  {
    "DistrictAlias": "D01",
    "DistrictNames": "District A"
  },
  {
    "DistrictAlias": "D02",
    "DistrictNames": "District B"
  }
]
FieldTypeRequiredNotes
DistrictAliasstringDistrict code; dropdown value and DISTRICT_ALIAS for the mandal call.
DistrictNamesstringLabel shown in the district dropdown.

Errors

StatusWhenWhat the app does
non-2xxServer rejects the call or the dataset query fails (CoreAPI handles session refresh internally)Resource.error with the raw response; the dropdown stays empty. In EndorsementRepositoryImpl the call runs without try/catch, so a thrown exception is not caught there. VoFilterRepoImpl catches it and shows "Something went wrong".
network errorNo connectivity or timeoutResource.error with the raw response; the dropdown stays empty. In EndorsementRepositoryImpl the call runs without try/catch, so a thrown exception is not caught there. VoFilterRepoImpl catches it and shows "Something went wrong".

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/EndorsementRepositoryImpl.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/VoFilterRepoImpl.kt
  • app/src/main/java/org/platformcommons/urvi/view/endorsements/vo/EndorsementFragment.kt
  • app/src/main/java/org/platformcommons/urvi/view/landasset/AddUpdateAssetNewDialog.kt
  • app/src/main/java/org/platformcommons/urvi/view/landasset/LandAssetViewModel.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/entity/voFilters/District.kt