APIs & services / urvi-app-service

Report a remote command as done, optionally attaching a zip of the app databases.

Endpointtoday's app
Call
PATCH /gateway/urvi-app-service/api/v1/remote-app-actions/{id}/execution
Service
urvi-app-service
Features
Device registration and remote actions, Sync error log
When
After running a remote action
Auth
X-Sessionid header
In the App Service

Use case

Online call from DeviceRegistrationViewModel.performAction after a remote command runs. For LOGOUT / CLEAR_APP_DATA, if the offline queue has failed operations the app zips its databases and sends it as a multipart 'file' part (support diagnostics); on success it logs out (and for CLEAR_APP_DATA wipes app data) and returns to Splash. Other action types are just marked completed. Exceptions are swallowed, so the action stays pending and is re-fetched next start.

Headers

HeaderValueNotes
X-SESSIONID<session token>Passed explicitly as a Retrofit @Header from AndroidSessionManager.sessionId; AuthInterceptor also re-auths and retries once on 401/400.
Content-Typemultipart/form-data (only when a zip is attached)Two Retrofit overloads: multipart with file, or plain PATCH.

Parameters

ParamInRequiredExampleNotes
remoteAppActionIdpathYes31From the GET list.
executionStatusqueryYesEXECUTION_STATUS.COMPLETEDAlways COMPLETED.
appExecutionDateTimequeryYes1780000000000Now, epoch ms.

Request

Example request body (synthetic data)
{
  "file": "<multipart part: app-data.zip (optional)>"
}
FieldTypeRequiredNotes
filebinary (zip)NoPresent only when the sync queue has unevaluated ops with attemptCount > 0 (ZipUtil.zipAppDataAndReturnFile).

Response

Example response body (synthetic data)
{
  "id": 31,
  "actionType": "LOGOUT",
  "executionStatus": "EXECUTION_STATUS.COMPLETED"
}
FieldTypeRequiredNotes
(body)RemoteAppActionDtoNot read; only isSuccessful matters.

Errors

StatusWhenWhat the app does
401 / 400Session token expiredAuthInterceptor invalidates the token, gets a fresh session id and retries the request once.
any non-2xxOther failuresNo logout happens; action remains pending on the server and is fetched again next time.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • app/src/main/java/org/platformcommons/urvi/view/deviceregistration/DeviceRegistrationViewModel.kt