APIs & services / asset-service

Update a 2024-25 (legacy season) annual action plan.

Endpointtoday's app
Call
PATCH /gateway/asset-service/api/v1/annual-action-plans
Service
asset-service
Features
KAP / Annual Action Plan 2025-26
When
User edits legacy AAP (queued directly, no ledger)
Auth
X-SESSIONID stamped when queued (CoreAPI dooWithRetry); X-REQUESTID idempotency key
In the App Service

Use case

Updates the legacy 2024-25 annual action plan from the older AAP screen (AnnualActionPlanFragment -> AnnualActionPlanViewModel -> IeRepositoryImpl.updateAnnualActionPlanData -> IEFlatEntity.patchAnnualActionPlan). There is no dedicated slug for the legacy season, so it is grouped under kap-25-26. appCreatedAt is set to now and the operation is queued directly with dooWithRetry, with no sync ledger. On 2xx, AnnualActionPlanPatchRH prints the response and updates the last-sync time. On error it retries later.

Headers

HeaderValueNotes
X-SESSIONID<session id>Stamped by CoreAPI when the queued operation runs (CoreAPIDefaultImpl.doOperation). On a 401 the token is invalidated and the call retried. BaseResponseHandler also refreshes the session after a 500 on a gateway URL (first 5 attempts).
X-REQUESTID<uuid v4>Idempotency key added by the offline queue (OperationManagerImpl). A 409 replaces it with a new UUID. It is removed for multipart requests.
Content-Typeapplication/jsonSet by the HTTP client for JSON bodies.

Request

Example request body (synthetic data)
{
  "id": 6001,
  "ownerEntityId": "880001",
  "ownerEntityType": "ENTITY_TYPE.IE",
  "category": "C3",
  "designation": "Farmer",
  "totalLandExtent": "2.5",
  "agrade202324": "1",
  "agrade202425": "2",
  "atm202324": "0",
  "atm202425": "1",
  "c1Extent202324PrePopulatedData": "0.5",
  "c1Extent202324UpdatedData": "0.5",
  "c1Extent202425": "1.0",
  "desiCows202324PrePopulatedData": "1",
  "desiCows202324UpdatedData": "1",
  "desiCows202425": "2",
  "dkgExtent202324PrePopulatedData": "0.1",
  "dkgExtent202324UpdatedData": "0.1",
  "dkgExtent202425": "0.2",
  "dgc202324": "YES",
  "dgc202425": "YES",
  "nfExtentInCB202324PrePopulatedData": "1.0",
  "nfExtentInCB202324UpdatedData": "1.0",
  "nfExtentInCB202425": "1.5",
  "pmdsExtent202324PrePopulatedData": "0.5",
  "pmdsExtent202324UpdatedData": "0.5",
  "pmdsExtent202425": "1.0",
  "s2sExtent202324PrePopulatedData": "0",
  "s2sExtent202324UpdatedData": "0",
  "s2sExtent202425": "0.5",
  "appCreatedAt": "1748772000000"
}
FieldTypeRequiredNotes
idintYesServer id of the existing plan (from the AAP2024_25 dataset).
ownerEntityId / ownerEntityTypestringYesFarmer IE id. ENTITY_TYPE.IE.
category, designation, totalLandExtentstringNoHeader values.
*202324PrePopulatedDatastringNoPrevious season pre-filled values (read-only on the form).
*202324UpdatedDatastringNoCadre-corrected previous-season values.
*202425 (agrade, atm, c1Extent, desiCows, dkgExtent, dgc, nfExtentInCB, pmdsExtent, s2sExtent)stringNoPlanned 2024-25 values from the form, as strings.
appCreatedAtstring (epoch ms)YesSet to now on save.

Response

Example response body (synthetic data)
{
  "id": 6001,
  "ownerEntityId": "880001",
  "ownerEntityType": "ENTITY_TYPE.IE",
  "category": "C3",
  "designation": "Farmer",
  "totalLandExtent": "2.5",
  "agrade202324": "1",
  "agrade202425": "2",
  "atm202324": "0",
  "atm202425": "1",
  "c1Extent202324PrePopulatedData": "0.5",
  "c1Extent202324UpdatedData": "0.5",
  "c1Extent202425": "1.0",
  "desiCows202324PrePopulatedData": "1",
  "desiCows202324UpdatedData": "1",
  "desiCows202425": "2",
  "dkgExtent202324PrePopulatedData": "0.1",
  "dkgExtent202324UpdatedData": "0.1",
  "dkgExtent202425": "0.2",
  "dgc202324": "YES",
  "dgc202425": "YES",
  "nfExtentInCB202324PrePopulatedData": "1.0",
  "nfExtentInCB202324UpdatedData": "1.0",
  "nfExtentInCB202425": "1.5",
  "pmdsExtent202324PrePopulatedData": "0.5",
  "pmdsExtent202324UpdatedData": "0.5",
  "pmdsExtent202425": "1.0",
  "s2sExtent202324PrePopulatedData": "0",
  "s2sExtent202324UpdatedData": "0",
  "s2sExtent202425": "0.5",
  "appCreatedAt": "1748772000000"
}
FieldTypeRequiredNotes
(body)AnnualActionPlanLogged only.

Errors

StatusWhenWhat the app does
401Session expiredCoreAPI invalidates the session id and retries once. If it still fails, the response handler returns TryAgain.LATER and the operation stays in the queue.
409Duplicate X-REQUESTIDSyncQueueProcessor records the request id and swaps in a fresh X-REQUESTID for the next attempt.
4xx/5xx (other)Server rejects or failsonError returns TryAgain.LATER (AnnualActionPlanPatchRH). Each failure is logged in the local error_log table (URL, body, headers). Every 10th attempt (up to attempt 5000) the whole operation is copied to Firestore urvi_sync_log. A 500 on a gateway URL in the first 5 attempts forces a session refresh.

Source

  • data/src/main/java/org/mindtree/app/agricultor/data/entity/IEFlatEntity.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/entity/AnnualActionPlan.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/IeRepositoryImpl.kt
  • app/src/main/java/org/platformcommons/urvi/view/ie/AnnualActionPlanViewModel.kt
  • app/src/main/java/org/platformcommons/urvi/view/ie/AnnualActionPlanFragment.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/AnnualActionPlanPatchRH.kt