Load asset classification data.
Endpointtoday's app
- Call
GET S3 igx-static-data/asset/classification.json- Service
- S3 static data
- Features
- Home and bottom bar, Land assets, Livestock
- When
- Every Home open
- Auth
- None (public)
- In the App Service
Use case
This is the second step of DataUtil.insertAssets, called only after ref_data.json succeeds on Home open. It downloads the valid combinations of asset category, sub-category and functionality, which drive the land and livestock forms. It is an online, asynchronous enqueue. The result and ref_data are written together by insertAssetData on the disk executor. On failure the app falls back to bundled local asset data.
Headers
| Header | Value | Notes |
|---|---|---|
X-SESSIONID | <session id> | PII/secret leak: the S3 client uses the shared OkHttpClientInterceptor, so AuthInterceptor attaches the user session token to this public S3 request (and to the product_base_url JSON fetch). The bucket is public and does not need it. |
Request
No body.
Response
[
{
"id": 11,
"isActive": true,
"createdDateTime": 1700000000000,
"assetCategory": {
"code": "ASSET_CATEGORY.LAND"
},
"assetSubCategory": {
"code": "ASSET_SUB_CATEGORY.LAND_OWNED"
},
"assetFunctionality": {
"code": "ASSET_FUNCTIONALITY.IRRIGATED"
}
}
]| Field | Type | Required | Notes |
|---|---|---|---|
[].id | int | Primary key of the classification row. | |
[].isActive | boolean | Stored. Filtering by it is not visible in the caller. | |
[].createdDateTime | long (epoch ms) | Stored, not read. | |
[].assetCategory.code | string | For example land or livestock. | |
[].assetSubCategory.code | string | For example owned, leased-in or D-patta land, or a livestock type. | |
[].assetFunctionality.code | string | For example irrigated or rain-fed. |
Errors
| Status | When | What the app does |
|---|---|---|
non-2xx, empty list or network failure | S3 unreachable | insertAssetLocal() loads the bundled reference data. |
Source
- app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
- app/src/main/java/org/platformcommons/urvi/utility/DataUtil.kt
- app/src/main/java/org/platformcommons/urvi/view/home/HomeActivity.kt
- app/src/main/java/org/platformcommons/urvi/datasource/database/entity/AssetClassificationData.kt