Skip to main content

The documentation

Everything the portal shows comes from the documentation section of the Otoroshi API: a JSON object, inline in the API, or loaded from a URL.

A guide of a portal

Its fields​

FieldTypeDescription
enabledbooleanEnable or disable the portal
sourceobject | nullLoad the documentation from a URL (see below)
homeresourceThe home page, below the hero of the portal
logoresourceThe logo and favicon of the portal
referencesreference[]The OpenAPI specifications of the API reference
resourcesresource[]Everything the portal serves: pages, specifications, images…
navigationsidebar[]The tabs of the top bar, each with a sidebar of pages
redirectionsredirection[]Paths redirected to others
footerresource | nullThe text of the footer (HTML when its content_type is text/html)
bannerresource | nullA notice above the top bar (HTML when its content_type is text/html)
metadataobjectThe settings of the portal (portal.*)
searchobject{ "enabled": true }, not used yet

The plans developers take keys of are the plans of the API itself (see Plans).

Resources​

A resource is anything the portal serves at a path.

FieldTypeDescription
pathstringWhere it is served (e.g. /docs/getting-started)
titlestringIts title (the title of the browser tab, of its card on the home)
descriptionstringIts summary, on its card on the home (the first paragraph of an inline Markdown page by default)
content_typestringtext/markdown, text/html, application/json, image/png…
site_pagebooleantrue: a page of the portal, in its layout. false or absent: served as is
text_contentstringIts content, inline
json_contentobjectIts content, inline JSON
base64_contentstringIts content, base64 encoded (images…)
urlstringIts content, fetched from this URL each time it is served
http_headersobjectHeaders sent when fetching url (a token for a private repository: never shown on the portal)
transformstringmarkdown renders the content as Markdown (a text/markdown content type does too); scalar (or redoc) shows it as a specification in the API reference
transform_wrapperstringHTML around a Markdown content, {content} where it goes

The content comes from url, else base64_content, else json_content, else text_content. A page whose url answers an error is shown with a short notice instead of its content.

Markdown and HTML pages​

A Markdown page is rendered in the browser: GitHub-flavoured Markdown, code highlighted with a copy button, headings with anchors, tables that scroll. An HTML page is shown as is. Both get an On this page table of contents from their h2 and h3.

The links and images of a page that start with / are paths of the portal: written /docs/errors, they are served under the prefix of the portal, or under /apis/<slug> in a catalog.

Each entry of navigation is a tab of the top bar, with a sidebar of its pages. Its path (or the first of its paths) opens its first page.

{
"label": "Guides",
"path": "/docs",
"items": [
{
"label": "Introduction",
"kind": "category",
"links": [
{ "label": "Getting started", "link": "/docs/getting-started" },
{ "label": "Authentication", "link": "/docs/authentication" }
]
},
{ "label": "FAQ", "link": "/docs/faq" }
]
}

Items are categories ("kind": "category" with links) or links. A page of a tab gets the previous and next pages of the tab at its bottom; the pages of the tabs are also listed on the home. Icons ("icon": { "css_icon_class": "bi bi-book" }, Bootstrap Icons) are shown on the cards of the specifications.

Redirections​

{ "from": "/old-docs", "to": "/docs/getting-started" }

/logout always redirects to the Otoroshi logout.

A remote documentation​

The whole documentation can come from a JSON file, to keep the portal in git next to the API:

{
"documentation": {
"enabled": true,
"source": { "url": "https://raw.githubusercontent.com/my-org/my-api/main/portal.json" }
}
}

The file has the same format. Its resources with a relative url (./docs/intro.md) are fetched next to it. The documentation is kept 15 seconds before it is fetched again.