Uploads photos taken as answers in the Certification survey or an Activity History submission. For each answer with an image, CertificationViewModel decodes the base64 image to a temp JPG (saveImage), inserts a local AttachmentEntity, and builds AssessmentUtils.getAttachmentOperation(responseUuid, file). That is a multipart POST that depends on the parent AIA POST through AttachmentIntegrator, queued with dooWithRetry and no ledger. ClearSyncQueueWorker later removes queued uploads whose file no longer exists, after copying the operation to Firestore urvi_attachment_issue. On error it retries later.
Headers
Header
Value
Notes
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
(removed)
CoreAPIDefaultImpl.processOperation removes X-REQUESTID for multipart requests, so file uploads have no idempotency key.
Content-Type
multipart/form-data; boundary=<generated>
Built by CoreAPI makeMultiPartHttpRequest because the operation has a File param.
Parameters
Param
In
Required
Example
Notes
aIADefaultResponseUUID
query
Yes
resp-0000-4000-8000-000000000001
UUID of the answer (aiadefaultResponseList[].uuid) the file belongs to. ClearSyncQueueWorker matches on this name (UUID_TAG).
attachment
form
Yes
image123.jpg
The multipart part is named "attachment" (from the library bytecode), not "file". PII: photo of the farmer or field.
Request
Example request body (synthetic data)
{
"attachment": {
"part": "binary JPEG decoded from the captured base64 image"
}
}
Handled by the library's AttachmentResponseHandler. Fields are not read by app code. Shape is assumed from the library AttachmentEntity.
Errors
Status
When
What the app does
401
Session expired
CoreAPI invalidates the session id and retries once. If it still fails, the response handler returns TryAgain.LATER and the operation stays in the queue.
409
Duplicate X-REQUESTID
SyncQueueProcessor records the request id and swaps in a fresh X-REQUESTID for the next attempt.
4xx/5xx (other)
Server rejects or fails
onError returns TryAgain.LATER (library AttachmentResponseHandler). 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.
n/a (file missing)
Temp image deleted before upload
ClearSyncQueueWorker copies the operation to Firestore urvi_attachment_issue and deletes it from the queue on success.