APIs & services / portfolio-service

Download compact blocks for the selected VOs, paged.

Endpointtoday's app
Call
GET /gateway/portfolio-service/api/v1/compact-block?direction=desc&page&size&voIds=
Service
portfolio-service
Features
Data download (Unit / FMT), Compact Block
When
Data download (Unit In-charge "compact_block" step)
Auth
X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
In the App Service

Use case

Online paged read in the Unit In-charge data download 'compact_block' step (UnitDataSetupViewModel). For each selected VO the first page (size 100) gives totalElements, then remaining pages are pulled; progress (total/pulled pages) is stored per work node so an interrupted download resumes. Blocks are saved to compact_block tables. A failed page throws and marks the step failed.

Headers

HeaderValueNotes
X-SESSIONID<session token>Added by AuthInterceptor (data/net/AuthInterceptor.kt) when the call does not set it; on HTTP 401 or 400 the interceptor invalidates the token, fetches a new one and retries the request once.

Parameters

ParamInRequiredExampleNotes
directionqueryYesdescFixed in URL.
pagequeryYes11-based.
sizequeryYes100Fixed page size.
voIdsqueryYesVO-ALIAS-01One VO alias per request.

Request

No body. voIds, page, size

Response

Example response body (synthetic data)
{
  "elements": [
    {
      "id": 6101,
      "name": "Compact Block A",
      "compactBlockCreatedAt": "2026-07-01",
      "compactBlockLastUpdateAt": "2026-07-01",
      "titleId": "CB-TITLE-0001",
      "note": "Adjacent paddy lands",
      "active": true,
      "inActiveReason": null,
      "createdByApp": 109,
      "lastModifiedByApp": 109,
      "createdFromDevice": "<device id>",
      "lastUpdatedFromDevice": "<device id>",
      "compactBlockMembers": [
        {
          "assetCheckSum": "<asset checksum>",
          "assetCode": "ASSET-CODE-0001",
          "assetId": 9001,
          "id": 6201,
          "joiningDate": "2026-07-01",
          "leavingDate": null,
          "titleId": "CB-TITLE-0001",
          "notes": null,
          "owningEntityId": "40001",
          "owningEntityType": "ENTITY_TYPE.IE",
          "active": true,
          "inActiveReason": null,
          "shgId": "SHG-ALIAS-01",
          "vo": "VO-ALIAS-01",
          "uuid": "cbm-0000-4000-8000-000000000701",
          "portfolioLineItemTitleId": "TILE-0001",
          "portfolioLineItemId": 6001,
          "portfolioId": 5001,
          "createdByApp": 109,
          "lastModifiedByApp": 109,
          "createdFromDevice": "<device id>",
          "lastUpdatedFromDevice": "<device id>"
        }
      ]
    }
  ],
  "totalElements": 1
}
FieldTypeRequiredNotes
elements[]CompactBlock[]Saved to compact_block / compact_block_member.
totalElementsintegerUsed to compute total pages = ceil(total/100).

Errors

StatusWhenWhat the app does
401 / 400Session token expiredAuthInterceptor invalidates the token, gets a fresh session id and retries the request once.
any non-2xxOther failuresThrows 'Failed to fetch Compact Block for VO <alias> at page <n>' -> step error; resumes from the stored page on retry.

Source

  • data/src/main/java/org/mindtree/app/agricultor/data/setup/SetupService.kt
  • app/src/main/java/org/platformcommons/urvi/view/datasetup/UnitDataSetupViewModel.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/entity/CompactBlockResponse.kt