APIs & services / asset-service

Load comments on an endorsed entity.

Endpointtoday's app
Call
GET /gateway/asset-service/api/v1/endorsementComment?entityID&entityType&page&size
Service
asset-service
Features
VO / SHG / Farmer endorsement, Farmer endorsement details
When
User opens comments
Auth
X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
In the App Service

Use case

Loads the comment thread for an endorsed VO, SHG or farmer when the user opens comments (EndorsementViewModel.getCommentForId -> EndorsementRepositoryImpl, a NetworkBoundResource). It shows local comments first. It calls the server only when online and either the cache is empty or a reload is requested. Results are saved to endorsement_comment_entity. Page size is 50. On failure the cached list remains.

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
entityIDqueryYes880001Entity id. Note the capital ID.
entityTypequeryYesENTITY.TYPE.FARMEREntity type.
pagequeryYes0Page index.
sizequeryYes50OFFSET_SIZE = 50.

Request

No body. entityID, entityType, 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": "Cadre A",
    "timeStamp": 1748772000000,
    "description": "Please verify the land extent.",
    "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
non-2xx / networkFailureNetworkBoundResource emits an error and the cached comments stay visible.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/setup_new/SetupServiceNew.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
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/entity/EndorsementCommentEntity.kt