APIs & services / portfolio-service

Download portfolio attachments by id (Unit In-charge setup).

Endpointtoday's app
Call
GET /gateway/portfolio-service/api/v1/portfolios/attachment/bulk?portfolioAttachmentIds=
Service
portfolio-service
Features
Data download (Unit / FMT), Geofencing
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 the Unit In-charge / FMT setup (SetupForUnitInChargeLogin.fetchPortfolio). The geoFenceAttachments ids of downloaded PLIs are sent in chunks of 50; only .kml files are kept, saved locally and linked to the PLI with updatePortfolioLineItemGeoFencing. Errors are logged to Crashlytics and the setup continues.

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
portfolioAttachmentIdsqueryYes88002,88003CSV, chunk of 50.

Request

No body. attachment ids

Response

Example response body (synthetic data)
[
  {
    "attachmentDateTime": "2026-07-01T10:15:00.000+05:30",
    "fileName": "geofence_tile_0001.kml",
    "attachmentKind": "ATTACHMENT_KIND.GEOFENCE",
    "attachmentKindMetaData": "<?xml version=\"1.0\"?><kml>...polygon...</kml>",
    "attachmentKindIdentifier": 6001,
    "attachmentUUID": "a1b2c3d4-0000-4000-8000-000000000401",
    "id": 88002,
    "uuid": "a1b2c3d4-0000-4000-8000-000000000402",
    "tempAttachmentURL": "https://<storage-host>/signed/geofence_tile_0001.kml?sig=<redacted>",
    "appCreatedAt": "1780000000000"
  }
]
FieldTypeRequiredNotes
idintegerAttachment id; highest id per type wins. Stored as imageAttachmentId / geoFenceAttachments / geoFencingFileId.
fileNamestringExtension decides handling: .jpg/.jpeg/.png/.webp = photo, .kml = geofence.
tempAttachmentURLstringSigned URL saved as the image URL (or KML path fallback).
attachmentKindMetaDatastringFor KML, the file content; saved to files/geofencing/<fileName>.
attachmentDateTimestringSaved as geoFencingCreatedOn.
appCreatedAtstringSaved as imageCreatedAt.
attachmentKind, attachmentKindIdentifier, attachmentUUID, uuidmixedDeserialised but not read by the app.

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; geofence not linked.

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/setup/AttachmentResponse.kt