Endpointtoday's app
Call PATCH /ctld/api/inventory/inventoryproduct/v1?inventoryId=Service Common TLD (ctld) Features Crop stock (inventory) When Queued sync (INVENTORY_PRODUCT PATCH) Auth X-SESSIONID stamped when queued (CoreAPI dooWithRetry); X-REQUESTID idempotency key In the App Service Use case Queued update of an existing stock item (INVENTORY_PRODUCT PATCH). The response is not read; success closes the ledger entry. Failures retry.
Headers Header Value Notes 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/json Added by CoreAPI.
Parameters Param In Required Example Notes inventoryIdquery Yes 9201inventory.id of the product.
Request Example request body (synthetic data) [
{
"usableQuantity": 10,
"notes": null,
"aliasId": "ip-alias-0001",
"quantity": 10,
"quantityInUOM": {
"id": 0,
"value": 10,
"uom": {
"symbol": "kg",
"code": "UOM.KG",
"unitName": "Kilogram",
"measurementType": {
"label": "Weight",
"dataCode": "MEASUREMENT_TYPE.WEIGHT",
"globalRefClass": {
"classCode": "GREF.MEASUREMENT_TYPE",
"name": "Measurement type"
},
"language": {
"language": "English",
"languageCode": "ENG"
}
}
}
},
"id": 9101,
"isActive": true,
"productSKU": {
"id": 7101
},
"uom": {
"symbol": "kg",
"code": "UOM.KG",
"unitName": "Kilogram",
"measurementType": {
"label": "Weight",
"dataCode": "MEASUREMENT_TYPE.WEIGHT",
"globalRefClass": {
"classCode": "GREF.MEASUREMENT_TYPE",
"name": "Measurement type"
},
"language": {
"language": "English",
"languageCode": "ENG"
}
}
},
"inventory": {
"owningEnitityId": 40001,
"notes": null,
"owningEntityType": "ENTITY_TYPE.IE",
"name": "Farmer A inventory",
"id": 9201,
"isActive": true,
"supervisor": {
"isActive": true,
"id": 0,
"aliasId": "ie-alias-0001",
"actorId": "40001",
"actorType": {
"dataCode": "ACTOR_TYPE.IE",
"globalRefClass": {
"classCode": "GREF.ACTOR_TYPE"
},
"language": {
"languageCode": "ENG"
}
}
}
},
"appMillMetadata": {
"ie_appId": "ie-alias-0001"
},
"appId": "ip-0000-4000-8000-000000000901",
"syncStatus": "SYNC_PENDING"
}
]Field Type Required Notes [0].productSKU.idinteger Yes Crop/input SKU chosen on the Inventory screen (product SKU master built from the ctld product list). [0].quantity / usableQuantity / quantityInUOM / uommixed Yes Stock quantity and unit. [0].inventory.idinteger No Server inventory id (0 on first product; PATCH also sends it as ?inventoryId). [0].inventory.supervisor.actorId / aliasId / actorTypemixed Yes Farmer IE id and alias; actorId filled from IE once synced. [0].inventory.owningEnitityId / owningEntityType / namemixed No Owner (sic: 'owningEnitityId' spelling is what is sent). [0].isActive, notes, aliasIdmixed No aliasId is the client id of the inventory product row. [0].appMillMetadata.ie_appId, appId, opId, syncStatusstring No Local columns; ignored by server.
Response Example response body (synthetic data) [
{
"usableQuantity": 10,
"notes": null,
"aliasId": "ip-alias-0001",
"quantity": 10,
"quantityInUOM": {
"id": 0,
"value": 10,
"uom": {
"symbol": "kg",
"code": "UOM.KG",
"unitName": "Kilogram",
"measurementType": {
"label": "Weight",
"dataCode": "MEASUREMENT_TYPE.WEIGHT",
"globalRefClass": {
"classCode": "GREF.MEASUREMENT_TYPE",
"name": "Measurement type"
},
"language": {
"language": "English",
"languageCode": "ENG"
}
}
}
},
"id": 9101,
"isActive": true,
"productSKU": {
"id": 7101
},
"uom": {
"symbol": "kg",
"code": "UOM.KG",
"unitName": "Kilogram",
"measurementType": {
"label": "Weight",
"dataCode": "MEASUREMENT_TYPE.WEIGHT",
"globalRefClass": {
"classCode": "GREF.MEASUREMENT_TYPE",
"name": "Measurement type"
},
"language": {
"language": "English",
"languageCode": "ENG"
}
}
},
"inventory": {
"owningEnitityId": 40001,
"notes": null,
"owningEntityType": "ENTITY_TYPE.IE",
"name": "Farmer A inventory",
"id": 0,
"isActive": true,
"supervisor": {
"isActive": true,
"id": 0,
"aliasId": "ie-alias-0001",
"actorId": "40001",
"actorType": {
"dataCode": "ACTOR_TYPE.IE",
"globalRefClass": {
"classCode": "GREF.ACTOR_TYPE"
},
"language": {
"languageCode": "ENG"
}
}
}
},
"appMillMetadata": {
"ie_appId": "ie-alias-0001"
}
}
]Field Type Required Notes (body)InventoryProduct[] Not read.
Errors Status When What the app does 401Session token expired or invalid CoreAPI invalidates the session id and retries once immediately; if still failing the op stays in the queue (TryAgain.LATER). 500Server error on a /gateway URL BaseResponseHandler fetches a new session id (first 5 attempts) and returns TryAgain.LATER; retried per RetryScheduler policy (retry threshold/delay come from app config). 503Service unavailable CoreAPI retries once immediately, then the op is retried later by the sync queue. any non-2xxAny other failure Handler 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/InventoryProduct.kt data/src/main/java/org/mindtree/app/agricultor/data/sync/work/InventoryProductWorker.kt data/src/main/java/org/mindtree/app/agricultor/data/sync/rh/InventoryProductPatchRH.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