APIs & services / S3 static data

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

HeaderValueNotes
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

Example response body (synthetic data)
[
  {
    "id": 11,
    "isActive": true,
    "createdDateTime": 1700000000000,
    "assetCategory": {
      "code": "ASSET_CATEGORY.LAND"
    },
    "assetSubCategory": {
      "code": "ASSET_SUB_CATEGORY.LAND_OWNED"
    },
    "assetFunctionality": {
      "code": "ASSET_FUNCTIONALITY.IRRIGATED"
    }
  }
]
FieldTypeRequiredNotes
[].idintPrimary key of the classification row.
[].isActivebooleanStored. Filtering by it is not visible in the caller.
[].createdDateTimelong (epoch ms)Stored, not read.
[].assetCategory.codestringFor example land or livestock.
[].assetSubCategory.codestringFor example owned, leased-in or D-patta land, or a livestock type.
[].assetFunctionality.codestringFor example irrigated or rain-fed.

Errors

StatusWhenWhat the app does
non-2xx, empty list or network failureS3 unreachableinsertAssetLocal() 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