APIs & services / Program TLD (ptld)

Update a farmer profile or farming category / gap start date.

Endpointtoday's app
Call
PATCH /ptld/api/customworknode/v1/worknodeietag/urvi/ie
Service
Program TLD (ptld)
Features
Add/Edit farmer (IE profile), Farmer category (Farmer/C4/C5)
When
Queued sync (IE PATCH, PATCH_CATEGORY) after user edits a farmer
Auth
X-SESSIONID stamped when queued (CoreAPI dooWithRetry); X-REQUESTID idempotency key
In the App Service

Use case

Queued update of a farmer (IEWorker). IE PATCH sends the full edited IE from the Edit Farmer screen; PATCH_CATEGORY sends a minimal IE (id, person.notes = category, personProfile.notes = full category path, gapStartDate) when the member category is changed. IEPatchRH writes returned child ids back by aliasId. Failures retry from the queue.

Headers

HeaderValueNotes
X-SESSIONID<session token>Stamped when the operation is queued (dooWithRetry) and re-set by CoreAPI at send time; refreshed on 401.
X-REQUESTID<uuid v4>Idempotency key generated by OperationManagerImpl.createOperation for POST/PUT/PATCH when the op enters the offline queue.
X-ACK-REQUESTID<X-REQUESTID of an earlier completed op>Added by SyncQueueProcessor for POST/PUT/PATCH: acknowledges a request id the device already saw succeed.
Content-Typeapplication/jsonAdded by CoreAPI.

Parameters

ParamInRequiredExampleNotes
shgAliasIdqueryNoSHG-ALIAS-01From addressLine2 JSON when present.
shgNamequeryNoSHG AFrom addressLine2 JSON when present.

Request

Example request body (synthetic data)
[
  {
    "aliasId": "ie-alias-0001",
    "iconpic": null,
    "id": "40001",
    "interestedInTrade": false,
    "idString": null,
    "iEStatus": {
      "dataCode": "IE_STATUS.ACTIVE"
    },
    "onBoardedTenant": {
      "loginName": "tenant_a",
      "id": 11
    },
    "caretakerTenant": {
      "loginName": "tenant_a",
      "id": 11
    },
    "person": {
      "id": 50001,
      "notes": "C4",
      "aliasId": "ie-alias-0001",
      "personProfile": {
        "lastName": "A",
        "occupation": "Farming",
        "caste": null,
        "noOfChildren": 2,
        "dateOfBirth": "1985-01-01",
        "religion": null,
        "firstName": "Farmer",
        "middleName": null,
        "id": 60001,
        "age": 41,
        "notes": "Member Category/C4",
        "inActiveReason": null,
        "gapStartDate": "2026-06-01",
        "lifeStatus": {
          "dataCode": "LIFE_STATUS.ALIVE"
        },
        "gender": {
          "dataCode": "GENDER.FEMALE"
        },
        "disabilityStatus": {
          "dataCode": "DISABILITY_STATUS.NO"
        },
        "avgMonthlyIncome": {
          "id": 0,
          "value": 5000,
          "currency": {
            "code": "INR"
          }
        },
        "bloodGroup": null,
        "salutation": null,
        "maritalStatus": {
          "dataCode": "MARITAL_STATUS.MARRIED"
        },
        "category": {
          "dataCode": "CATEGORY.SC"
        }
      },
      "personContacts": [
        {
          "iEId": "ie-alias-0001",
          "isPrimary": true,
          "id": 0,
          "contact": {
            "contactValue": "9XXXXXXXX1",
            "id": 0,
            "contactType": {
              "dataCode": "CONTACT_TYPE.MOBILE"
            }
          }
        }
      ],
      "personAddresses": [
        {
          "iEId": "ie-alias-0001",
          "isPrimary": true,
          "id": 0,
          "address": {
            "id": 0,
            "pinCode": "5XXXX1",
            "addressLine1": "Habitation A",
            "addressLine2": "{\"shgId\":\"SHG-ALIAS-01\",\"shgName\":\"SHG A\"}",
            "state": {
              "dataCode": "STATE.AP"
            },
            "city": null,
            "village": {
              "dataCode": "VILLAGE.V001"
            },
            "panchayat": {
              "dataCode": "PANCHAYAT.P001"
            },
            "district": {
              "dataCode": "DISTRICT.D001"
            },
            "country": {
              "dataCode": "COUNTRY.IN"
            },
            "town": null,
            "taluk": {
              "dataCode": "MANDAL.M001"
            }
          }
        }
      ],
      "personEducationList": [
        {
          "iEId": "ie-alias-0001",
          "education": "Primary",
          "id": 0,
          "isActive": true,
          "educationCategory": {
            "dataCode": "EDUCATION.PRIMARY"
          }
        }
      ],
      "personFamilyList": [
        {
          "iEId": "ie-alias-0001",
          "age": 45,
          "id": 0,
          "isActive": true,
          "memberName": "Relative A",
          "occupation": "Farming",
          "notes": null,
          "contact": {
            "contactValue": "9XXXXXXXX2",
            "id": 0,
            "isActive": true,
            "contactType": {
              "dataCode": "CONTACT_TYPE.MOBILE"
            }
          },
          "relationship": {
            "dataCode": "RELATIONSHIP.HUSBAND"
          }
        }
      ],
      "personIdentifierList": [
        {
          "iEId": "ie-alias-0001",
          "id": 0,
          "personIdentifierNumber": "XXXX-XXXX-1234",
          "identifierType": {
            "dataCode": "PERSON_IDENTIFIER.AADHAR_ID"
          },
          "isActive": true
        }
      ]
    },
    "iETaggingList": [
      {
        "iEId": "ie-alias-0001",
        "id": 0,
        "taggingType": {
          "dataCode": "TAGGING_TYPE.WORKNODE"
        },
        "taggedToTenant": {
          "loginName": "tenant_a",
          "id": 11
        }
      }
    ],
    "appId": "ie-alias-0001",
    "syncStatus": "SYNC_PENDING"
  }
]
FieldTypeRequiredNotes
[] (array of one IE)arrayYesSame IE shape as the create call.
[0].aliasIdstringYesClient farmer id (UUID), unique on ie.aliasId; server echoes it.
[0].idstringNoServer IE id ('0'/null on create).
[0].person.personProfile.firstName / lastName / middleName / dateOfBirth / age / gender / maritalStatus / category / occupation / noOfChildrenmixedYesAdd/Edit farmer form.
[0].person.personProfile.notes / person.notes / gapStartDatestringNoMember category path (e.g. 'Member Category/C4') and category last-change date; PATCH_CATEGORY sends only id + these.
[0].person.personContacts[]arrayNoMobile number (CONTACT_TYPE.MOBILE).
[0].person.personAddresses[].addressobjectNoLocation codes from the selected work node; addressLine2 is a JSON string with shgId/shgName (also lifted into shgAliasId/shgName query params).
[0].person.personEducationList[] / personFamilyList[]arrayNoEducation and husband/father details.
[0].person.personIdentifierList[]arrayNoAadhaar (PERSON_IDENTIFIER.AADHAR_ID) and ration card numbers; masked here.
[0].iETaggingList[]arrayNoTenant/work node tagging.
[0].iEStatus, interestedInTrade, onBoardedTenant, caretakerTenantmixedNoStatus and tenant references.
[0].appId, opId, syncStatusstringNoLocal columns serialised by Gson; ignored by server.
PATCH_CATEGORY variantobjectNoOnly id, person.notes, person.personProfile.notes, person.personProfile.gapStartDate are populated (from ie_flat_entity).

Response

Example response body (synthetic data)
[
  {
    "aliasId": "ie-alias-0001",
    "iconpic": null,
    "id": "40001",
    "interestedInTrade": false,
    "idString": null,
    "iEStatus": {
      "dataCode": "IE_STATUS.ACTIVE"
    },
    "onBoardedTenant": {
      "loginName": "tenant_a",
      "id": 11
    },
    "caretakerTenant": {
      "loginName": "tenant_a",
      "id": 11
    },
    "person": {
      "id": 50001,
      "notes": "C4",
      "aliasId": "ie-alias-0001",
      "personProfile": {
        "lastName": "A",
        "occupation": "Farming",
        "caste": null,
        "noOfChildren": 2,
        "dateOfBirth": "1985-01-01",
        "religion": null,
        "firstName": "Farmer",
        "middleName": null,
        "id": 60001,
        "age": 41,
        "notes": "Member Category/C4",
        "inActiveReason": null,
        "gapStartDate": "2026-06-01",
        "lifeStatus": {
          "dataCode": "LIFE_STATUS.ALIVE"
        },
        "gender": {
          "dataCode": "GENDER.FEMALE"
        },
        "disabilityStatus": {
          "dataCode": "DISABILITY_STATUS.NO"
        },
        "avgMonthlyIncome": {
          "id": 0,
          "value": 5000,
          "currency": {
            "code": "INR"
          }
        },
        "bloodGroup": null,
        "salutation": null,
        "maritalStatus": {
          "dataCode": "MARITAL_STATUS.MARRIED"
        },
        "category": {
          "dataCode": "CATEGORY.SC"
        }
      },
      "personContacts": [
        {
          "iEId": "ie-alias-0001",
          "isPrimary": true,
          "id": 0,
          "contact": {
            "contactValue": "9XXXXXXXX1",
            "id": 0,
            "contactType": {
              "dataCode": "CONTACT_TYPE.MOBILE"
            }
          }
        }
      ],
      "personAddresses": [
        {
          "iEId": "ie-alias-0001",
          "isPrimary": true,
          "id": 0,
          "address": {
            "id": 0,
            "pinCode": "5XXXX1",
            "addressLine1": "Habitation A",
            "addressLine2": "{\"shgId\":\"SHG-ALIAS-01\",\"shgName\":\"SHG A\"}",
            "state": {
              "dataCode": "STATE.AP"
            },
            "city": null,
            "village": {
              "dataCode": "VILLAGE.V001"
            },
            "panchayat": {
              "dataCode": "PANCHAYAT.P001"
            },
            "district": {
              "dataCode": "DISTRICT.D001"
            },
            "country": {
              "dataCode": "COUNTRY.IN"
            },
            "town": null,
            "taluk": {
              "dataCode": "MANDAL.M001"
            }
          }
        }
      ],
      "personEducationList": [
        {
          "iEId": "ie-alias-0001",
          "education": "Primary",
          "id": 0,
          "isActive": true,
          "educationCategory": {
            "dataCode": "EDUCATION.PRIMARY"
          }
        }
      ],
      "personFamilyList": [
        {
          "iEId": "ie-alias-0001",
          "age": 45,
          "id": 0,
          "isActive": true,
          "memberName": "Relative A",
          "occupation": "Farming",
          "notes": null,
          "contact": {
            "contactValue": "9XXXXXXXX2",
            "id": 0,
            "isActive": true,
            "contactType": {
              "dataCode": "CONTACT_TYPE.MOBILE"
            }
          },
          "relationship": {
            "dataCode": "RELATIONSHIP.HUSBAND"
          }
        }
      ],
      "personIdentifierList": [
        {
          "iEId": "ie-alias-0001",
          "id": 0,
          "personIdentifierNumber": "XXXX-XXXX-1234",
          "identifierType": {
            "dataCode": "PERSON_IDENTIFIER.AADHAR_ID"
          },
          "isActive": true
        }
      ]
    },
    "iETaggingList": [
      {
        "iEId": "ie-alias-0001",
        "id": 0,
        "taggingType": {
          "dataCode": "TAGGING_TYPE.WORKNODE"
        },
        "taggedToTenant": {
          "loginName": "tenant_a",
          "id": 11
        }
      }
    ]
  }
]
FieldTypeRequiredNotes
[0].idstringServer IE id -> ie.id and ie_flat_entity.IEOLTPId (updateIEOLTPIdRH); also patched into pending role maps / portfolios.
[0].aliasIdstringMatches the local farmer row.
[0].person.id / person.personProfile.idintegerSaved via updateIEIds.
[0].person.personAddresses[].id / address.idintegerSaved via updateAddressIds.
[0].person.personContacts[].id / contact.id / contact.contactType.dataCodemixedSaved via updateContactId.
[0].person.personEducationList[].id, personFamilyList[].id/contact.id/relationship, personIdentifierList[].id/identifierTypemixedChild ids written back; Aadhaar number re-read to update the flat row.
[0].person.personProfile.gapStartDatestringIE_FLAT only: written to ie_flat_entity.gapStartDate.

Errors

StatusWhenWhat the app does
401Session token expired or invalidCoreAPI invalidates the session id and retries once immediately; if still failing the op stays in the queue (TryAgain.LATER).
500Server error on a /gateway URLBaseResponseHandler fetches a new session id (first 5 attempts) and returns TryAgain.LATER; retried per RetryScheduler policy (retry threshold/delay come from app config).
503Service unavailableCoreAPI retries once immediately, then the op is retried later by the sync queue.
any non-2xxAny other failureHandler onError -> TryAgain.LATER (op stays queued and is visible in Pending Sync); a row is written to the local error_log table (Sync Error Log screen) with URL, body, headers and raw response; every 10th attempt the op is mirrored to Firestore for support.

Source

  • data/src/main/java/org/mindtree/app/agricultor/data/entity/IE.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/work/IEWorker.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/IEPatchRH.kt
  • app/src/main/java/org/platformcommons/urvi/bridge/BridgeSyncHelper.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/manager/CoreAPIManager.kt
  • data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/BaseResponseHandler.kt
  • offline-core/src/main/java/com/mindtree/bridge/coreapi/offline/SyncQueueProcessor.java
  • offline-core/src/main/java/com/mindtree/bridge/coreapi/offline/manager/OperationManagerImpl.java
  • core-api/src/main/java/com/mindtree/bridge/coreapi/impl/CoreAPIDefaultImpl.java