App bootstrap & content
When your shop or app starts, it reads what it needs to draw itself: the market, language and currency, the interface texts, the theme and the menu. Content such as articles and pages is read when a screen needs it. Every call here works with any session, a guest's included.
On start#
- Start a session and keep its token; see Sessions & sign-in. The session's market, language and currency are your app's defaults, and every call below uses them unless you pass others.
- Load the interface texts with
GET /session/translation. - Pick the theme:
GET /session/ui_themesgives the light and dark theme ids, andGET /session/theme?themeId=gives the settings of one. - Load the navigation with
GET /session/menu, and the pickers withGET /session/markets,/session/languagesand/session/currencies.
All paths below are under /api/v2 and take the session token in Authorization: Bearer.
Interface texts#
Every text of your app in one language, keyed the way your app and Admin name them. A text missing in the language comes from the language's fallback, and when that is missing too, the key itself is returned, so a screen always has something to show.
Query parameters
| Parameter | Description |
|---|---|
| languageIdinteger · default the session's | The language. |
| keystring | One text only. |
Returns
data: a list of key and translation, with id, app_id and language_id. Those three are null when the text came from a fallback.
curl "https://api.morffeus.com/api/v2/session/translation" \ -H "Authorization: Bearer $SESSION_TOKEN"
{
"data": [
{ "key": "Basket.Title", "translation": "Your basket", "language_id": 1, … },
{ "key": "Checkout.Pay", "translation": "Pay now", "language_id": 1, … }
]
}
Themes#
| Call | Returns |
|---|---|
| GET /session/ui_themes | data.light_ui_theme_id and data.dark_ui_theme_id: the app's default light and dark themes. Either can be null. |
| GET /session/theme | The settings of one theme as a list of element, value, value_type, category and description. Pass themeId; without it, the app's default theme. A setting the theme does not set comes from its fallback theme. details=true adds fallback_value. 404 with an empty body when there is no theme. |
Menu#
GET /session/menu returns the app's default menu as a tree, or another menu with type=. Each item has id, translation_key (look the label up in the texts), screen, icon, ordinal, parent_id, login, mobile_enabled and open_full_screen, with its children in level_x. Items are in ordinal order. No menu: 404 with an empty body.
Markets, languages, currencies#
| Call | Returns |
|---|---|
| GET /session/markets | Every market of your app: id, code, name, default, url, timezone, iso_country_code, and the switches login_enabled, checkout_enabled and maintenance_enabled. |
| GET /session/languages | The session market's languages, the default first: id, lang, lang_code, locale, name, short_name, default, image_url. marketId= for another market of yours, all=true for every market. |
| GET /session/currencies | The session market's currencies: id, name, sign, iso_code, display_price_format, default. marketId= for another market. |
Check maintenance_enabled, login_enabled and checkout_enabled on the current market before you offer sign-in or checkout.
Articles, pages, version#
| Call | Returns |
|---|---|
| GET /session/articles | The articles in the session's language that are published now, in ordinal order: id, title, excerpt, content, image_url, video_url, publish_on, publish_until, article_category_id and category_name. Filter with articleCategoryId. An article without a publish date is not returned. |
| GET /session/mpages | One page built in Admin, with its components in order: id, name, ordinal, and components, each with component, props and ordinal. Send the page's id as pageTypeId and its name. null when nothing matches. |
| GET /session/version | data.version: the version of the Morffeus platform, the same for every app. |
Related#
- Sessions & sign-in: the session token.
- Notifications & consent: what a signed-in customer manages.