Use case Online bulk read after farming models are downloaded (data download, farmer hub refresh). Farming model ids in chunks of 50; for each model the newest image becomes the ATM photo and the newest KML is saved and linked as its geofence (updateATMGeoFencingByTileId). Chunk failures are collected and fail the step.
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 farmingModelIdsquery Yes 5501,5502CSV, chunk of 50.
Request No body. farming model ids (chunk 50)
Response Example response body (synthetic data) {
"5501": [
{
"attachmentDateTime": "2026-07-01T10:15:00.000+05:30",
"fileName": "atm_5501.jpg",
"attachmentKind": "ATTACHMENT_KIND.IMAGE",
"attachmentKindMetaData": null,
"attachmentKindIdentifier": 6001,
"attachmentUUID": "a1b2c3d4-0000-4000-8000-000000000401",
"id": 88001,
"uuid": "a1b2c3d4-0000-4000-8000-000000000402",
"tempAttachmentURL": "https://<storage-host>/signed/pli_6001.jpg?sig=<redacted>",
"appCreatedAt": "1780000000000"
},
{
"attachmentDateTime": "2026-07-01T10:15:00.000+05:30",
"fileName": "geofence_tile_0001.kml",
"attachmentKind": "ATTACHMENT_KIND.GEOFENCE",
"attachmentKindMetaData": "<?xml version=\"1.0\"?><kml>...polygon...</kml>",
"attachmentKindIdentifier": 6001,
"attachmentUUID": "a1b2c3d4-0000-4000-8000-000000000401",
"id": 88002,
"uuid": "a1b2c3d4-0000-4000-8000-000000000402",
"tempAttachmentURL": "https://<storage-host>/signed/geofence_tile_0001.kml?sig=<redacted>",
"appCreatedAt": "1780000000000"
}
]
}Field Type Required Notes <farmingModelId> (map key)string Farming model id. <farmingModelId>[].idinteger Attachment id; highest id per type wins. Stored as imageAttachmentId / geoFenceAttachments / geoFencingFileId. <farmingModelId>[].fileNamestring Extension decides handling: .jpg/.jpeg/.png/.webp = photo, .kml = geofence. <farmingModelId>[].tempAttachmentURLstring Signed URL saved as the image URL (or KML path fallback). <farmingModelId>[].attachmentKindMetaDatastring For KML, the file content; saved to files/geofencing/<fileName>. <farmingModelId>[].attachmentDateTimestring Saved as geoFencingCreatedOn. <farmingModelId>[].appCreatedAtstring Saved as imageCreatedAt. <farmingModelId>[].attachmentKind, attachmentKindIdentifier, attachmentUUID, uuidmixed Deserialised but not read by the app.
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 Failure collected; step throws.
Source data/src/main/java/org/mindtree/app/agricultor/data/setup/SetupService.kt app/src/main/java/org/platformcommons/urvi/view/datasetup/DataSetupViewModel.kt app/src/main/java/org/platformcommons/urvi/view/option/OptionViewModel.kt