APIs & services / portfolio-service

Download compact blocks that include the given farmers.

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

Use case

Online read in SetupForUnitInChargeLogin.fetchCompactBlock: compact blocks containing any of the given farmers (chunks of 50) are saved to compact_block / compact_block_member. Failures are logged to Crashlytics and skipped.

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
cbmOwningEntityIdsqueryYes40001,40002CSV farmer IE ids.

Request

No body. IE ids (chunk 50)

Response

Example response body (synthetic data)
[
  {
    "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>"
      }
    ]
  }
]
FieldTypeRequiredNotes
[].id / name / titleId / note / active / inActiveReason / datesmixedcompact_block columns.
[].compactBlockMembers[]arraycompact_block_member rows (asset, farmer, SHG, VO, PLI link, uuid).

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 failuresCrashlytics non-fatal; data missing until next download.

Source

  • data/src/main/java/org/mindtree/app/agricultor/data/setup/SetupService.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/setup_new/SetupForUnitInChargeLogin.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/entity/CompactBlock.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/entity/CompactBlockMember.kt