Endpointtoday's app
Call GET /ctld/api/inventory/inventoryproduct/v1?inventoryId=0&criteria=isActive=true AND inventory.supervisor.actorId in (...)Service Common TLD (ctld) Features Data download (Cadre) , Crop stock (inventory) When Background data download (FetchIEDataWorker, FetchUserDataWorker) Auth X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400) In the App Service Use case Online read in the background download workers (Setup via FetchIEDataWorker, SetupForUser via FetchUserDataWorker). Inventory products of all farmers (supervisor actor ids) are fetched with a criteria string, local aliasId/appId are preserved for known ids, and rows are saved to inventoryproduct. On 401 the worker refreshes the session; other errors go to Crashlytics.
Headers Header Value Notes X-SESSIONID<session token> Added by AuthInterceptor (data/net/AuthInterceptor.kt) when the call does not set it; on HTTP 401 or 400 the interceptor invalidates the token, fetches a new one and retries the request once.
Parameters Param In Required Example Notes inventoryIdquery Yes 0Always 0 (filter by criteria instead). criteriaquery Yes isActive=true AND inventory.supervisor.actorId in (40001,40002)Client-built.
Request No body. client-built criteria with actor ids
Response Example response body (synthetic data) [
{
"usableQuantity": 10,
"notes": null,
"aliasId": "ip-alias-0001",
"quantity": 10,
"quantityInUOM": {
"id": 0,
"value": 10,
"uom": {
"symbol": "kg",
"code": "UOM.KG",
"unitName": "Kilogram",
"measurementType": {
"label": "Weight",
"dataCode": "MEASUREMENT_TYPE.WEIGHT",
"globalRefClass": {
"classCode": "GREF.MEASUREMENT_TYPE",
"name": "Measurement type"
},
"language": {
"language": "English",
"languageCode": "ENG"
}
}
}
},
"id": 9101,
"isActive": true,
"productSKU": {
"id": 7101
},
"uom": {
"symbol": "kg",
"code": "UOM.KG",
"unitName": "Kilogram",
"measurementType": {
"label": "Weight",
"dataCode": "MEASUREMENT_TYPE.WEIGHT",
"globalRefClass": {
"classCode": "GREF.MEASUREMENT_TYPE",
"name": "Measurement type"
},
"language": {
"language": "English",
"languageCode": "ENG"
}
}
},
"inventory": {
"owningEnitityId": 40001,
"notes": null,
"owningEntityType": "ENTITY_TYPE.IE",
"name": "Farmer A inventory",
"id": 9201,
"isActive": true,
"supervisor": {
"isActive": true,
"id": 0,
"aliasId": "ie-alias-0001",
"actorId": "40001",
"actorType": {
"dataCode": "ACTOR_TYPE.IE",
"globalRefClass": {
"classCode": "GREF.ACTOR_TYPE"
},
"language": {
"languageCode": "ENG"
}
}
}
}
}
]Field Type Required Notes [].idinteger Matched against existing rows to keep aliasId/appId. [].productSKU.id / quantity / usableQuantity / quantityInUOM / uommixed Shown on the Inventory screen. [].inventory.* incl. supervisor.actorId/aliasIdobject Links stock to a farmer.
Errors Status When What the app does 401 / 400Session token expired AuthInterceptor invalidates the token, gets a fresh session id and retries the request once. any non-2xxOther failures Crashlytics non-fatal; on 401 getNewSessionId() is called.
Source data/src/main/java/org/mindtree/app/agricultor/data/setup/SetupService.kt data/src/main/java/org/mindtree/app/agricultor/data/setup/Setup.kt data/src/main/java/org/mindtree/app/agricultor/data/setup/SetupForUser.kt data/src/main/java/org/mindtree/app/agricultor/data/entity/InventoryProduct.kt