APIs & services / asset-service

Get the download URL of an endorsement attachment, then download it.

Endpointtoday's app
Call
GET /gateway/asset-service/api/v1/endorsements/attachment?endorsementId&attachmentFormat=ATTACHMENT_URL
Service
asset-service
Features
VO / SHG / Farmer endorsement
When
User opens an endorsement attachment
Auth
X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
In the App Service

Use case

When the user opens the abstract attached to an endorsement on the endorsement screen (EndorsementViewModel -> EndorsementRepositoryImpl.getAbstractFile), the app asks for its attachment list, takes the last entry's tempAttachmentURL, and downloads the file with a second GET to that signed URL (downloadEndorsementFile, @Url). The file is saved as cacheDir/Downloaded_<fileName>, its path is stored on the endorsement row, and it is opened. This is a synchronous online call. If no attachment exists or the call fails, null is returned and nothing opens.

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
endorsementIdqueryYes3101Server endorsement id (EndorsementEntity.id).
attachmentFormatqueryYesATTACHMENT_URLDefault value. Asks for a temporary URL instead of inline bytes.

Request

No body. endorsementId

Response

Example response body (synthetic data)
[
  {
    "id": 42001,
    "uuid": "a1b2c3d4-0000-4000-8000-000000000042",
    "attachmentUUID": "a1b2c3d4-0000-4000-8000-000000000042",
    "fileName": "SHG_A_abstract.xlsx",
    "attachmentDateTime": "2025-06-02 10:15:00",
    "attachmentKind": "ATTACHMENT_KIND.FILE",
    "attachmentKindMetaData": null,
    "attachmentKindIdentifier": null,
    "tempAttachmentURL": "https://<signed-download-host>/<path>?<signature>",
    "appCreatedAt": "1748859300000"
  }
]
FieldTypeRequiredNotes
[].tempAttachmentURLstringSigned URL that the follow-up GET downloads. The last element is used.
[].fileNamestringUsed to build the local file name.
[].* (other AttachmentResponse fields)mixedNot read by the app.

Errors

StatusWhenWhat the app does
non-2xx / empty listNo attachmentReturns null and nothing opens.
download non-2xxSigned URL expiredReturns null.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/EndorsementRepositoryImpl.kt
  • app/src/main/java/org/platformcommons/urvi/view/endorsements/vo/EndorsementViewModel.kt