APIs & services / Reporting datasets (rtld)

Load help video links.

Endpointtoday's app
Call
GET /rtld/api/dataset/v1/execute?name=UrviYouTube
Service
Reporting datasets (rtld)
Features
Home and bottom bar
When
Every Home open
Auth
X-SESSIONID set by CoreAPI (dooNowOrThrow)
In the App Service

Use case

HomeViewModel.fetchYoutubeVideos runs each time Home opens and caches the list in SharedPreferences (KEY_YOUTUBE_VIDEO_LINKS). Module screens call AppUtils.getIfVideoButtonEnabled(module) to show a help-video button when visibility is "SHOW", and getYoutubeVideoLinkForModule(module) to embed the link in an iframe. Failures are logged and the old cache is used.

Headers

HeaderValueNotes
X-SESSIONID<session token>Added by Bridge CoreAPI from the AccountManager session when the Operation is executed with dooNowOrThrow. The app code does not set it.

Parameters

ParamInRequiredExampleNotes
namequeryYesUrviYouTubeDataset 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)
[
  {
    "module": "LAND_ASSET",
    "visibility": "SHOW",
    "youtube_link": "https://www.youtube.com/embed/EXAMPLE0001"
  },
  {
    "module": "CROP_PLAN",
    "visibility": "HIDE",
    "youtube_link": "https://www.youtube.com/embed/EXAMPLE0002"
  }
]
FieldTypeRequiredNotes
modulestringScreen key the video belongs to.
visibilitystring"SHOW" turns the help-video button on.
youtube_linkstringEmbed URL placed in the iframe (AppUtils.getYoutubeEmbedLink).

Errors

StatusWhenWhat the app does
non-2xxServer rejects the call or the dataset query fails (CoreAPI handles session refresh internally)Exception caught and logged; buttons follow the previous cache.
network errorNo connectivity or timeoutException caught and logged; buttons follow the previous cache.

Source

  • app/src/main/java/org/platformcommons/urvi/view/home/HomeViewModel.kt
  • app/src/main/java/org/platformcommons/urvi/utility/AppUtils.kt
  • app/src/main/java/org/platformcommons/urvi/datasource/network/responsedto/YoutubeVideoLinksDTO.kt