APIs & services / asset-service

Download endorsements (reviews) assigned to or made by the user.

Endpointtoday's app
Call
GET /gateway/asset-service/api/v1/endorsement/me?page&size
Service
asset-service
Features
VO / SHG / Farmer endorsement, Farmer endorsement details
When
One-time job when the endorsement screen opens (FetchEndorsementDataWorker)
Auth
X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
In the App Service

Use case

Downloads the endorsements made by or assigned to the logged-in user. It runs as a one-time FetchEndorsementDataWorker (network required, expedited), enqueued by FetchEndorsementsData.fetch() when the VO/SHG/Farmer Endorsement screen (EndorsementFragment) opens. This is not a periodic job. The page starts at 0 and size is Int.MAX_VALUE. A 206 response increments the page and recurses. The list is filtered by the ref-data endorsement start date, saved to endorsement_entity, copied onto VO/SHG/farmer IE flat rows (status, endorsedBy, date), and the "endorsement cached" preference is set. Any other status fails the worker, and the screen keeps cached data.

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
pagequeryYes0Starts at 0. Incremented on HTTP 206.
sizequeryYes2147483647Int.MAX_VALUE, so in practice there is no paging.

Request

No body. page, size

Response

Example response body (synthetic data)
[
  {
    "id": 3101,
    "uuid": "e0000000-0000-4000-8000-000000003101",
    "entityType": "ENTITY.TYPE.SHG",
    "entityId": "440012",
    "entityCode": "SHG-0012",
    "endorsedBy": "Cadre A",
    "endorsedUserId": 1001,
    "name": "SHG A",
    "status": "ENDORSED",
    "endorsementType": "SHG",
    "districtName": "District A",
    "unitName": "Unit A",
    "mandalCode": "M-01",
    "mandalName": "Mandal A",
    "voCode": "VO-01",
    "voName": "VO A",
    "shgCode": "SHG-0012",
    "shgName": "SHG A",
    "reviewdBy": null,
    "reviewByUserId": null,
    "reviewedTimestamp": null,
    "timestamp": 1748772000000,
    "createdAt": 1748772000000,
    "hasNpmShop": false,
    "abstractFile": null
  }
]
FieldTypeRequiredNotes
[].idintServer id. 0 for a new endorsement. Updated from the POST response.
[].uuidstringClient-generated primary key.
[].entityTypestringENTITY.TYPE.VO, ENTITY.TYPE.SHG or ENTITY.TYPE.FARMER.
[].entityId / entityCodestringVO, SHG or farmer server id and code. Used to update IE flat endorsement fields.
[].statusstringPENDING, ENDORSED, FLAGGED or FOR_REVIEW (VoConstants).
[].endorsedBy / endorsedUserIdstring / longPII: name and user id of the endorsing cadre.
[].reviewdBy / reviewByUserId / reviewedTimestampstring / long / longReviewer (unit in-charge). The misspelling "reviewdBy" is the wire name.
[].namestringPII when entityType is FARMER (farmer name).
[].districtName, unitName, mandalCode, mandalName, voCode, voName, shgCode, shgNamestringGeography and group context shown in lists.
[].endorsementTypestringVO, SHG or FARMER tab type.
[].hasNpmShopbooleanNPM shop flag on VO endorsements.
[].abstractFilestring|nullLocal file path of the abstract, also serialised. The server is not known to read it.
[].timestamplongEndorsement time (epoch ms).
[].createdAtlongMapped to created_at. FetchEndorsementDataWorker drops rows older than ref-data endorsementStartDate.

Errors

StatusWhenWhat the app does
206Partial contentFetches the next page recursively.
other non-200FailureResult.failure(). The screen falls back to cached rows.
401/400Session invalidAuthInterceptor re-authenticates and retries once.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/URLInjector.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/service/FetchEndorsementDataWorker.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/FetchEndorsementsData.kt
  • app/src/main/java/org/platformcommons/urvi/view/endorsements/vo/EndorsementFragment.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/entity/EndorsementEntity.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/EndorsementRepositoryImpl.kt