APIs & services / Reporting datasets (rtld)

Load program instructions.

Endpointtoday's app
Call
GET /rtld/api/dataset/v1/execute?name=PlusOneInstructions
Service
Reporting datasets (rtld)
Features
Program configuration and instructions
When
User opens program info
Auth
X-SESSIONID header (AuthInterceptor adds it; re-auth on 401/400)
In the App Service

Use case

Runs when the user opens Program Instructions (ProgramInstructionsFragment -> ProgramInfoRepositoryImpl.fetchProgramInstructions). The list is saved in SharedPreferences, then filtered to the selected language and sorted by instruction_order for display. Errors show a message and the cached copy stays.

Headers

HeaderValueNotes
X-SESSIONID<session token>Not set by the call site. AuthInterceptor (OkHttpClientInterceptor) adds it from AndroidSessionManager. On a 401 or 400 it invalidates the token, gets a fresh one and retries once.

Parameters

ParamInRequiredExampleNotes
namequeryYesPlusOneInstructionsDataset name. The rtld executor (/rtld/api/dataset/v1/execute) picks the dataset by this query param.
versionqueryYes1Dataset version. Always 1.
formatqueryYesjsonResponse format. Always json, so the body is a JSON array of row objects.

Request

No body.

Response

Example response body (synthetic data)
[
  {
    "Language": "ENG",
    "description": "Record land details before the crop plan.",
    "instruction_order": "1"
  },
  {
    "Language": "ENG",
    "description": "Sync pending data daily.",
    "instruction_order": "2"
  }
]
FieldTypeRequiredNotes
LanguagestringLanguage code; filtered to the selected language.
descriptionstringInstruction text.
instruction_orderstringSort key (string sort).

Errors

StatusWhenWhat the app does
401 / 400Session token expired or rejectedAuthInterceptor refreshes the token and retries once; if the retry also fails, Resource.error with the response message; the cached list is still shown.
5xxDataset query failed on the serverResource.error with the response message; the cached list is still shown.
network errorNo connectivity or timeoutResource.error with the response message; the cached list is still shown.

Source

  • app/src/main/java/org/platformcommons/urvi/datasource/network/retrofit/APIInterface.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/repository/impl/ProgramInfoRepositoryImpl.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/network/responsedto/ProgramInstructionsDTO.kt
  • app/src/main/java/org/platformcommons/urvi/view/home/program_instructions/ProgramInstructionsFragment.kt