APIs & services / raw-data-service

Download the SHG abstract as an Excel file.

Endpointtoday's app
Call
GET /raw-data-service/report/ryss-abstract/{id}/shg
Service
raw-data-service
Features
VO / SHG / Farmer endorsement
When
User taps download abstract
Auth
X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
In the App Service

Use case

On the endorsement screen (EndorsementFragment), tapping "download abstract" on a SHG card calls EndorsementRepositoryImpl.getShgAbstract on the network executor. This is an online call. The binary body is written to cacheDir/Report_<id>.xlsx and opened with an ACTION_VIEW intent (application/vnd.ms-excel). A toast appears if no spreadsheet app is installed or the body is empty. The callback reports success or failure to the fragment, which shows a message.

Headers

HeaderValueNotes
X-SESSIONID<session id>Passed explicitly as a @Header by the caller (AndroidSessionManager.sessionId). AuthInterceptor also fills it when missing, and on a 401 or 400 it invalidates the token, fetches a new one and retries once.

Parameters

ParamInRequiredExampleNotes
idpathYes440012SHG entity id (EndorsementEntity.entityId).
adminUserqueryYestrueAlways true. The endpoints.json path leaves it out, but the Retrofit method sends it.

Request

No body. shg id

Response

Example response body (synthetic data)
{
  "part": "binary Excel workbook (application/vnd.ms-excel or xlsx)"
}
FieldTypeRequiredNotes
(body)binarySHG abstract report, saved as Report_<id>.xlsx. PII: likely contains member names and land details for the group (contents are not parsed by the app).

Errors

StatusWhenWhat the app does
non-2xxReport not availablecallback(false), and the fragment shows a failure message.
2xx empty bodyNo dataToast R.string.null_data.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/EndorsementRepositoryImpl.kt
  • app/src/main/java/org/platformcommons/urvi/view/endorsements/vo/EndorsementViewModel.kt
  • app/src/main/java/org/platformcommons/urvi/view/endorsements/vo/EndorsementFragment.kt