M-SALT API Client

A reference implementation of a client of the M-SALT API.

Initialization

The user navigates to the SALT-Portal and starts the client application.

The client initializes itself, gets a list of known active APIs, and calls the GET /v1 endpoint of each known API to get the API status and further information.

participant User as u
participant Client as c
participant "API 1" as a1
participant "API 2" as a2
participant "API 3" as a3

skinparam sequence {
       LifeLineBackgroundColor LightGoldenRodYellow
}

u -> c: navigate
activate c

c -> c: GET list of\nknown APIs
note over c: list contains:\nAPI 1, API 2, and API 3

c -> a1: GET /v1
activate a1
c -> a2: GET /v1
activate a2
c -> a3: GET /v1
activate a3

note over a2
   responses are sent
   in arbitrary order
end note

a2 -> c: info
deactivate a2
c -> u: show info

a3 -> c: info
deactivate a3
c -> u: show info

a1 -> c: info
deactivate a1
c -> u: show info
deactivate c

Diagram of API calls for client initialization.

Article Retrieval

The client calls the GET /v1/articles/(id)/formats endpoint, retrieves the available formats from the API, and selects the most appropriate one. It then retrieves the article text (if not already embedded in the response) and displays it to the user. The client transliterates marked sections of the article if necessary. The client allows the user to page through articles retrieved in multiple parts (eg. as a series of scans).

participant User as u
participant Client as c
participant "API" as a1

skinparam sequence {
       LifeLineBackgroundColor LightGoldenRodYellow
}

u -> c: select\narticle
activate c

c -> a1: GET /v1/articles/42/formats
activate a1
a1 -> c: formats
deactivate a1
||20||
hnote over c : decide best format
||20||
loop eventually retrieve external urls
   c -> a1: GET external url
   activate a1
   a1 -> c: text or image
   deactivate a1
end
||20||
hnote over c: transliterate
||20||
c -> u: show\narticle

deactivate c

Diagram of API calls for article retrieval.