Load the static crop list.
Endpointtoday's app
- Call
GET /ie-registration/assets/json/inventory/crops-list.json- Service
- Platform static files
- Features
- Data download (Cadre), Data download (Unit / FMT), Home and bottom bar, Crop Plan, Crop Actual (portfolio)
- When
- Data download and Home open
- Auth
- X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
- In the App Service
Use case
Loads the crop master list (product codes, crop type and labels in each language) that crop pickers use. It runs during the cadre and unit data download (DataSetupViewModel / UnitDataSetupViewModel syncProductMaster), and again when Home opens if the local cropdata table is empty or any row has no cropType (DataUtil.getCropData). It is an online call only: on success the app deletes and re-inserts the cropdata table. On failure the data download step throws "Failed to fetch crop product data" and is marked ERROR; the Home refresh only logs the error.
Headers
| Header | Value | Notes |
|---|---|---|
X-SESSIONID | <session id> | DataUtil passes it explicitly. The setup-service path (SetupService.getCropProductData) relies on AuthInterceptor. The file is static, so the header is probably ignored. |
Request
No body.
Response
[
{
"id": 1,
"productCode": "PRODUCT.PADDY",
"sequenceNo": 1,
"cropType": "CROP_TYPE.MAIN_CROP",
"labelList": [
{
"language_code": "ENG",
"text": "Paddy"
},
{
"language_code": "TEL",
"text": "Paddy (TEL label)"
}
]
},
{
"id": 2,
"productCode": "PRODUCT.MARIGOLD",
"sequenceNo": 2,
"cropType": "CROP_TYPE.BIO_DIVERSITY_CROP",
"labelList": [
{
"language_code": "ENG",
"text": "Marigold"
}
]
}
]| Field | Type | Required | Notes |
|---|---|---|---|
[].id | int | Room primary key (autoGenerate) of cropdata. A server value overwrites it. | |
[].productCode | string | Crop code linked to portfolio line items. | |
[].sequenceNo | int | Sort order in crop pickers. | |
[].cropType | string | Values include CROP_TYPE.ASSOCIATED_CROP and CROP_TYPE.BIO_DIVERSITY_CROP (AppConstants.GeneralConstant). If any row has a null cropType, the list is downloaded again. | |
[].labelList[].language_code | string | ENG or TEL. | |
[].labelList[].text | string | Display label. |
Errors
| Status | When | What the app does |
|---|---|---|
non-2xx or empty body | File missing or server error | Data download: an exception marks the product-master step ERROR. Home: the error is swallowed and the existing table is kept. |
401/400 | Session invalid | AuthInterceptor re-authenticates and retries once. |
Source
- data/src/main/java/org/mindtree/app/agricultor/data/setup/SetupService.kt
- app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
- app/src/main/java/org/platformcommons/urvi/datasource/network/URLInjector.kt
- app/src/main/java/org/platformcommons/urvi/utility/DataUtil.kt
- app/src/main/java/org/platformcommons/urvi/view/datasetup/DataSetupViewModel.kt
- app/src/main/java/org/platformcommons/urvi/view/datasetup/UnitDataSetupViewModel.kt
- data/src/main/java/org/mindtree/app/agricultor/data/entity/CropData.kt
- app/src/main/java/org/platformcommons/urvi/view/home/HomeActivity.kt