APIs & services / commons-report-service

Get a farmer's owned land, used to validate land entries.

Endpointtoday's app
Call
GET /gateway/commons-report-service/api/v1/datasets/name/PlusOneGetOwnedLandByIEID/execute
Service
commons-report-service
Features
Leased land, Land assets, Crop Plan
When
User adds/edits land or ATM
Auth
X-SESSIONID set by CoreAPI (dooNowOrThrow)
In the App Service

Use case

Fetches a farmer's owned land parcels from the server. In the add/edit land dialog (leased-in / leased-to), LandAssetViewModel.getAssetDataFromIEID calls it together with PlusOneGetATMNFUsedAcreageByIEID for the other farmer and lists parcels with available acreage to pick. IePortfolioViewModel.getTotalAvailableLand uses it to check available land for the crop plan and falls back to local land data when the result is empty. Any failure returns an empty list.

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
datasetNamepathYesPlusOneGetOwnedLandByIEIDDataset 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.
paramsqueryYesIEID=100001Dataset input parameters as KEY=value pairs joined with "--". IEID = IE id of the farmer whose owned land is needed. Built into the URL string with version=1&format=json.

Request

No body. IEID

Response

Example response body (synthetic data)
[
  {
    "asset_id": "3001",
    "asset_last_modified_at": "1719792000000",
    "asset_asset_code": "LAND-0001",
    "acreage": "2.50",
    "khata_number": "KH-0001",
    "survey_number": "SY-12/3",
    "total_leased_land": "0.50",
    "total_available_land": "2.00"
  }
]
FieldTypeRequiredNotes
asset_idstringAsset id; joined with PlusOneGetATMNFUsedAcreageByIEID.asset_id; SelectAssetBinder.assetId.
asset_asset_codestringLand code shown in the picker.
acreagestringTotal parcel acreage (SelectAssetBinder.totalAcreage).
khata_number, survey_numberstringShown in the picker row.
total_available_landstringAvailable acreage; the app subtracts ATM+NF used acreage and shows the result.
total_leased_land, asset_last_modified_atstringParsed; not read by the picker.

Errors

StatusWhenWhat the app does
non-2xxServer rejects the call or the dataset query fails (CoreAPI handles session refresh internally)Exception or failure returns an empty list; the picker is empty (portfolio path falls back to local land data).
network errorNo connectivity or timeoutException or failure returns an empty list; the picker is empty (portfolio path falls back to local land data).

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/IeAssetRepositoryImpl.kt
  • app/src/main/java/org/platformcommons/urvi/view/landasset/LandAssetViewModel.kt
  • app/src/main/java/org/platformcommons/urvi/view/landasset/AddUpdateAssetNewDialog.kt
  • app/src/main/java/org/platformcommons/urvi/view/portfolio/IePortfolioViewModel.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/network/responsedto/AssetDataDTO.kt