APIs & services / asset-service

Poll for new comments to show as in-app notifications.

Endpointtoday's app
Call
GET /gateway/asset-service/api/v1/endorsementComment/postedby?page&size&postedBy
Service
asset-service
Features
Notifications
When
Periodic 1 h
Auth
X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
In the App Service

Use case

Feeds the in-app Notifications list. FetchCommentsNotificationWorker is a periodic WorkManager job every 1 hour (network required), set up from HomeActivity and NotificationsRepositoryImp. It asks for comments where postedBy="<userId>-notifications", page size 1000, and keeps paging while the server returns 206. The full result replaces every local row with commentType=NOTIFICATIONS. On failure the worker returns failure and the old notifications stay.

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
pagequeryYes0Incremented on 206.
sizequeryYes1000Fixed offsetSize.
postedByqueryYes1001-notificationsAndroidSessionManager.userId with the suffix "-notifications". PII: user id in the query string.

Request

No body. postedBy, page, size

Response

Example response body (synthetic data)
[
  {
    "id": 9001,
    "uuid": "c0000000-0000-4000-8000-000000009001",
    "entityType": "ENTITY.TYPE.FARMER",
    "entityId": "880001",
    "entityCode": "IE-880001",
    "postedBy": "1001-notifications",
    "timeStamp": 1748772000000,
    "description": "Endorsement for SHG A was flagged.",
    "commentType": null
  }
]
FieldTypeRequiredNotes
[].idintServer id. The POST response (a plain integer) is stored back here.
[].uuidstringClient primary key.
[].entityType / entityId / entityCodestringEntity being commented on (VO, SHG or farmer).
[].postedBystringPII: author display name. The notification query uses "<userId>-notifications".
[].timeStamplongWire name timeStamp (@SerializedName). Epoch ms.
[].descriptionstringFree-text comment from the Resolve Comments screen. PII: may contain farmer details.
[].commentTypestring|nullLocal only. Set to NOTIFICATIONS for rows saved by the notification worker. Serialised on POST.

Errors

StatusWhenWhat the app does
206More pagesFetches the next page.
non-2xx / exceptionFailurePaging stops. Result.failure on exception. Existing notifications are kept.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/service/FetchCommentsNotificationWorker.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/NotificationsRepositoryImp.kt
  • app/src/main/java/org/platformcommons/urvi/view/home/HomeActivity.kt