APIs & services / asset-service

Refetch one asset from the server to repair a sync error.

Endpointtoday's app
Call
GET /gateway/asset-service/api/v1/assets/{assetId}
Service
asset-service
Features
Land assets, Crop Plan, ATM model (Anytime Money plot), Sync error log
When
After a sync error (from response handlers)
Auth
X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
In the App Service

Use case

Repairs local land data after a crop or ATM sync is rejected because of the asset. When IEPortfolioPostRH, IEPortfolioPatchRH, PortfolioLineItemPutRH(WithCropChange) or FarmingModelPostRH receive ERR_PLATFORM_ASSET_CHECKSUM_MISMATCH or ERR_PLATFORM_ASSET_TOTAL_QUANTITY_LIMIT_EXCEED, they enqueue FetchFarmerAssetDataWorker with the asset id taken from the server errorMessage. The worker (data/utils/LandDataUpdateWorker.kt; a copy also exists in app/utility/FarmerDataUpdateWorker.kt) calls this endpoint online and overwrites the local farmerassets row, keeping the local appId and geofence columns. It then writes a SyncErrorLogs row, flags the line item or ATM as having a sync error, and shows a notification. On failure, response.body()!! throws and the worker fails without updating anything.

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
assetIdpathYes5501Server asset id parsed from the sync error's errorMessage.

Request

No body. assetId

Response

Example response body (synthetic data)
{
  "id": 5501,
  "owningEntityId": "880001",
  "assetCode": "AST-0001",
  "dateOfPurchase": null,
  "ownerEntityType": {
    "code": "OWNER_ENTITY.IE",
    "refClass": {
      "code": "OWNER_ENTITY"
    }
  },
  "assetCategory": {
    "code": "ASSET_CATEGORY.LAND",
    "refClass": {
      "code": "ASSET_CATEGORY"
    },
    "labels": [
      {
        "id": 1,
        "text": "Land",
        "language": {
          "code": "ENG",
          "label": "English"
        }
      }
    ]
  },
  "assetSubCategory": {
    "code": "ASSET_SUB_CATEGORY.LAND_OWNED",
    "refClass": {
      "code": "ASSET_SUB_CATEGORY"
    },
    "labels": [
      {
        "id": 2,
        "text": "Owned",
        "language": {
          "code": "ENG",
          "label": "English"
        }
      }
    ]
  },
  "assetFunctionality": {
    "code": "ASSET_FUNCTIONALITY.IRRIGATED",
    "refClass": {
      "code": "ASSET_FUNCTIONALITY"
    },
    "labels": []
  },
  "quality": null,
  "totalQuantity": {
    "id": 9001,
    "value": 1.5,
    "uoM": {
      "symbol": "ac",
      "code": "UOM.ACRE",
      "name": "Acre",
      "description": null,
      "measurementType": {
        "code": "AREA",
        "name": "Area",
        "description": null,
        "globalRefClass": {
          "code": "MEASUREMENT_TYPE",
          "name": null,
          "description": null
        }
      }
    }
  },
  "nameList": [
    {
      "id": 77,
      "text": "Survey 12/3",
      "language": {
        "code": "ENG",
        "label": "English"
      }
    }
  ],
  "assetSpecsList": [
    {
      "id": 300,
      "specName": "SURVEY_NUMBER",
      "specValue": "12/3",
      "uuid": "0f0e0d0c-0000-4000-8000-000000000001"
    }
  ],
  "appMillMetadata": {
    "ie_appId": "IE-APP-UUID-0001"
  },
  "assetCheckSum": "9e107d9d372bb6826bd81d3542a419d6",
  "authenticated": true,
  "notes": null,
  "isLeased": false,
  "leaseStatus": null,
  "leaseType": null,
  "leasedFromOwningEntityId": null,
  "leasedToOwningEntityId": null,
  "leasedFromAssetId": null,
  "leasedFromWorknodeCode": null,
  "leasedFromWorknodeType": null,
  "isActive": true,
  "inactiveReason": null,
  "inactiveAt": null,
  "createdAt": "2025-06-01T10:00:00Z",
  "lastModifiedAt": "2025-06-02T10:00:00Z",
  "appCreatedAt": "1748772000000",
  "appLastModifiedAt": "1748858400000",
  "createdByApp": 1,
  "lastModifiedByApp": 1,
  "createdFromDevice": "DEVICE-XXXX",
  "lastUpdatedFromDevice": "DEVICE-XXXX"
}
FieldTypeRequiredNotes
idintServer asset id. 0 or null when creating.
owningEntityIdstringFarmer IE id (server). If it is not numeric, replacePlatformValues swaps in the server IE id resolved from appMillMetadata.ie_appId.
assetCodestringBusiness code of the asset. Also sent with the geofence upload.
dateOfPurchasestring|nullLivestock purchase date.
ownerEntityType.codestringOWNER_ENTITY.IE for farmers, OWNER_ENTITY.BRIDGE_USER for the cadre's own assets (FarmerAssetsMapper).
assetCategory.code / assetSubCategory.code / assetFunctionality.code / quality.codestringValues from the asset ref data (land or livestock picker on the Land and Livestock screens).
*.labels[]arrayLocalised labels, stored in asset_*_labels tables.
totalQuantity.valuedoubleLand extent (acres) or head count, from the Extent field. On an "Integrity" error, the RH sets a null value to 0.0 and re-queues.
totalQuantity.uoMobjectUnit of measure (code, symbol, measurementType).
nameList[].textstringAsset name or survey label. PII: may contain survey or land identifiers.
assetSpecsList[]arrayspecName/specValue pairs (for example survey number). PII: land record identifiers.
appMillMetadata.ie_appIdstringLocal app id of the farmer, used to resolve owningEntityId offline.
assetCheckSumstringMD5 of the asset name plus total quantity (IeAsset.setMD5Hash). The server uses it to detect checksum mismatches (ERR_PLATFORM_ASSET_CHECKSUM_MISMATCH).
authenticatedbooleanLand authenticated toggle.
isLeased, leaseStatus, leaseType, leasedFrom*/leasedTo*mixedLeased-land screen fields.
isActive, inactiveReason, inactiveAtboolean/string/longSoft-delete state. inactiveReason also goes in the DELETE query.
createdAt, lastModifiedAt, appCreatedAt, appLastModifiedAt, createdByApp, lastModifiedByApp, createdFromDevice, lastUpdatedFromDevicestring/longAudit fields. Device ids are device identifiers.
(type)n/aThe data module parses it as FarmerAssets (SetupServiceNew). APIInterface declares IeAsset for the same path, but that method is not used by these workers.

Errors

StatusWhenWhat the app does
non-2xx / empty bodyAsset not found or server errorNullPointerException on body()!!. The worker returns failure, the local data is not repaired, and the portfolio operation keeps retrying.
401/400Session invalidAuthInterceptor re-authenticates and retries once.

Source

  • data/src/main/java/org/mindtree/app/agricultor/data/setup_new/SetupServiceNew.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/utils/LandDataUpdateWorker.kt
  • app/src/main/java/org/platformcommons/urvi/utility/FarmerDataUpdateWorker.kt
  • app/src/main/java/org/platformcommons/urvi/utility/AssetIdBroadcastReceiver.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/IEPortfolioPostRH.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/IEPortfolioPatchRH.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/PortfolioLineItemPutRH.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/FarmingModelPostRH.kt