APIs & services / portfolio-service

Refresh a farmer's current farming model (ATM).

Endpointtoday's app
Call
GET /gateway/portfolio-service/api/v1/farming-model/ownerEntities/actual?ownerEntityId&ownerEntityType&date&appCreatedAt
Service
portfolio-service
Features
ATM model (Anytime Money plot)
When
User opens ATM screen
Auth
X-SESSIONID set by CoreAPI (dooNowOrThrow)
In the App Service

Use case

Online CoreAPI call (dooNowOrThrow) from ATMRepositoryImp.fetchATMDataNow when the user refreshes the farmer's ATM list. Returned farming models get local geofence file info copied by titleId and are saved to farming_model. Empty result is treated as success; errors return the raw response as an error.

Headers

HeaderValueNotes
X-SESSIONID<session token>Set by CoreAPIDefaultImpl.doOperation from the session manager; on 401 the session is invalidated and the call retried once (dooNowOrThrow = 1 retry).
Content-Typeapplication/jsonAlways added by CoreAPI for non-multipart requests.

Parameters

ParamInRequiredExampleNotes
ownerEntityIdqueryYes40001Farmer IE id.
ownerEntityTypequeryYesENTITY_TYPE.IEFixed.
datequeryYes2026/07/01First day of current month.
appCreatedAtqueryYes1780000000000Now, epoch ms.

Request

No body. ownerEntityId, ownerEntityType, date, appCreatedAt

Response

Example response body (synthetic data)
[
  {
    "uuid": "fm-0000-4000-8000-000000000501",
    "appCreatedAt": 1780000000000,
    "id": 5501,
    "raisedBeds": true,
    "vegetableCrops": "PRODUCT.SPINACH,PRODUCT.OKRA",
    "maizeCultivation": false,
    "pulseCrops": "PRODUCT.REDGRAM",
    "practices": "PRACTICE.MULCHING",
    "relayCropping": false,
    "relayCroppingDetails": null,
    "incomeGeneration": true,
    "incomeGenerationDetails": "Sells surplus locally",
    "titleId": "TILE-0002",
    "owningEntityId": "40001",
    "owningEntityType": "ENTITY_TYPE.IE",
    "aliasId": "ie-alias-0001",
    "landSize": 0.1,
    "isDKG": false,
    "modelType": "MODEL_TYPE.ATM",
    "assetId": 9002,
    "asset": "ASSET-CODE-0002",
    "assetCheckSum": "<asset checksum>",
    "hasSyncError": false,
    "syncErrorId": null,
    "lastModifiedAt": null,
    "geoFencingFileId": null,
    "geoFencingFileName": null,
    "geoFencingCreatedOn": null,
    "geoFencingFilePath": null,
    "geotaggingFileName": null,
    "geotaggingCreatedOn": null,
    "geotaggingFilePath": null,
    "farmingModelLineItemDTOs": [
      {
        "actualOutput": null,
        "appCreatedAt": 1780000000000,
        "appLastModifiedAt": 1780000000000,
        "createdAt": null,
        "cropChangeReason": null,
        "cropSubType": "CROP_SUB_TYPE.LEAFY",
        "cropType": "CROP_TYPE.VEGETABLE",
        "earlyHarvestReason": null,
        "expectedHarvestDate": "2026-09-01",
        "expectedOutput": null,
        "genericProduct": "PRODUCT.SPINACH",
        "harvestCompleteDateTime": null,
        "harvestStartDateTime": null,
        "harvestStatus": "HARVEST_STATUS.PENDING",
        "harvestType": null,
        "id": null,
        "inactiveAt": null,
        "inactiveReason": null,
        "interestedInCropMarketing": false,
        "isActive": true,
        "isMajorCrop": false,
        "lastModifiedAt": null,
        "surplusOutput": null
      }
    ],
    "imageUrl": null,
    "imageAttachmentId": null,
    "imageCreatedAt": null
  }
]
FieldTypeRequiredNotes
[] (FarmingModel)arraySaved to farming_model (see farming-model POST for fields).

Errors

StatusWhenWhat the app does
401Session token expiredCoreAPI invalidates the session and retries once.
503Service unavailableCoreAPI retries once.
any non-2xxOther failuresResource.error(rawResponse) on the ATM screen.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/ATMRepositoryImp.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/entity/FarmingModel.kt