First step of the cadre farmer download on the Data Setup screen (DataSetupViewModel). It counts farmers in the selected habitation / VO / village so the app can work out the number of pages (count / page size, page size from ref data or 250). Progress is saved so a failed download resumes from the failed page. A failed call or a count of 0 throws, and the screen shows the download as failed.
Headers
Header
Value
Notes
X-SESSIONID
<session token>
Not set by the call site. AuthInterceptor (OkHttpClientInterceptor) adds it from AndroidSessionManager. On a 401 or 400 it invalidates the token, gets a fresh one and retries once.
Parameters
Param
In
Required
Example
Notes
datasetName
path
Yes
PlusOneWorkNodeFarmerListGeoWiseCount
Dataset name in the path of commons-report-service /api/v1/datasets/name/{name}/execute.
version
query
Yes
1
Dataset version. Always 1.
format
query
Yes
json
Response format. Always json, so the body is a JSON array of row objects.
Dataset input parameters as KEY=value pairs joined with "--". WORK_NODE_HABITATION_ALIAS = selected habitation alias; WORK_NODE_VO_ALIAS = selected VO alias; WORK_NODE_VILLAGE_ALIAS = selected village alias. Values are not quoted here.
Request
No body. WORK_NODE_HABITATION_ALIAS, WORK_NODE_VO_ALIAS, WORK_NODE_VILLAGE_ALIAS
Response
Example response body (synthetic data)
[
{
"TotalFarmer": 312
}
]
Field
Type
Required
Notes
TotalFarmer
int
Total farmers for the geography (IeFlatSchemaCountResponse.totalFarmer); used to compute total pages, saved in PREF_KEY_FARMER_SYNC_TOTAL_PAGES.
Errors
Status
When
What the app does
401 / 400
Session token expired or rejected
AuthInterceptor refreshes the token and retries once; if the retry also fails, DataSetupViewModel throws "Failed to fetch farmer count"; the download status becomes failed and can be retried.
5xx
Dataset query failed on the server
DataSetupViewModel throws "Failed to fetch farmer count"; the download status becomes failed and can be retried.
network error
No connectivity or timeout
DataSetupViewModel throws "Failed to fetch farmer count"; the download status becomes failed and can be retried.
200 with TotalFarmer 0
No farmers in the geography
Throws "No farmers found for the selected work node".