mmo-api-console
1 symbole · générée le 30 Nov 2026
mmo-api-console
mmo-api-console.jhs:1A console to discover and try an API, from its OpenAPI document (mmo.core's api.json): its operations grouped by tag and searched, one opened in mmo-api-operation -- its form typed by its schemas, examples, the answer explained. The calls are made as the session of the page, or as a token pasted (kept in memory, for this tab only). The link of an operation (#op=GET /path) opens it. No third-party script: written with mmo.client, it runs under the site's Content-Security-Policy.
- Étend
- CustomShadowElement
Index
| url | the OpenAPI document (MMO.url('api.json') by default) | |
| token | the token a copied curl shows for the session (the page gives it, or nothing: $TOKEN) | |
| live | present when the user may call the API live from the console (mmo.oauth: the scope api.live) | |
| production | present on a production site: going live asks to type the site's name | |
| schemas | the JSON schemas of the entities (MMO.url('data/schemas.json') by default), for the Entities tab and the data api's query builder | |
| diagram | an SVG of the data model, shown in the Entities tab (optional) Four tabs: Start (how to call the API, what it answers, first calls), Operations, Entities (mmo-api-entities), My access (mmo-api-acce… | |
| init() | ||
| load() async | Load the document and draw the list. | |
| showTab(tab, link) | Show a tab. | |
| openOperation(method, path, values) | Open an operation by its method and path, its parameters filled in. | |
| schemaOf(collection) async | ||
| explain(call) async | Why a call was refused, or answered an empty list: mmo.oauth's explanation, as the account it was made as. | |
| drawStart() | Draw the Start tab: how a call is made, what it answers, the errors, the first calls. | |
| setIdentity(identity) | Who the calls are made as. | |
| loginAs() async | Log in as another account, by its password (mmo.oauth's login.json): its token is kept in memory, for this tab; the page's own session is untouched. | |
| clientLogin() async | Call as an API client: its id and secret exchanged for a token (mmo.oauth's oauth/token, client_credentials), kept in memory -- what the client's own code does. | |
| fillAccounts() async | Offer the accounts an administrator may call as: the review of the accesses (mmo.oauth), those with a login | |
| callAs() async | Call as an account, for an administrator (mmo.oauth's user/api-token.json: the right to switch account, an account they could manage): a short token, kept in memory. | |
| askToken(url, headers, body) async | ||
| useToken(answer, account) | Make the calls with a token got for an account. | |
| headers() | ||
| site() | ||
| who() | ||
| drawMode() | Draw the mode: the banner, and the switch for whoever may go live. | |
| toggleLive() async | Switch between the dry run and live, for whoever may (live): going live is confirmed, by typing the site's name on a production site. | |
| curlToken() | ||
| confirmCall(call) | Asked before a call that may change data. | |
| filtered() | ||
| drawNav() | Draw the list of the operations, by tag. | |
| open(op, values) | Open an operation, and give it its link. | |
| openFromHash() | Open what the address names: an operation (#op=GET /path) or a tab (#tab=entities). | |
| remember(detail) | A call just made: marked in the list, remembered in the history (what makes it, never a token nor an answer). | |
| replay(item) async | Open a call remembered: its operation, its values, its query, its body -- not sent. |
Attributs6
url
mmo-api-console.jhsthe OpenAPI document (MMO.url('api.json') by default)
url
token
mmo-api-console.jhsthe token a copied curl shows for the session (the page gives it, or nothing: $TOKEN)
token
live
mmo-api-console.jhspresent when the user may call the API live from the console (mmo.oauth: the scope api.live)
live
production
mmo-api-console.jhspresent on a production site: going live asks to type the site's name
production
schemas
mmo-api-console.jhsthe JSON schemas of the entities (MMO.url('data/schemas.json') by default), for the Entities tab and the data api's query builder
schemas
diagram
mmo-api-console.jhsan SVG of the data model, shown in the Entities tab (optional) Four tabs: Start (how to call the API, what it answers, first calls), Operations, Entities (mmo-api-entities), My access (mmo-api-access: the account's rights, its perimeter, « Can I…? »). The address says which (#tab=start, #tab=entities, #tab=access, #op=GET /path for an operation). An answer refused (401, 403) or an empty list is explained by mmo.oauth's access/explain.json, when the site has it.
diagram
Méthodes27
init()
mmo-api-console.jhs:102load()
asyncmmo-api-console.jhs:131Load the document and draw the list.
| retourne | Promise<void> |
showTab(tab, link)
mmo-api-console.jhs:171Show a tab.
| tab | string | start, operations, entities |
| link = true | boolean | give it its address (#tab=...) |
openOperation(method, path, values)
mmo-api-console.jhs:199Open an operation by its method and path, its parameters filled in.
| method | string | |
| path | string | |
| values = {} | Object | |
| retourne | boolean | whether the document has it |
schemaOf(collection)
asyncmmo-api-console.jhs:210| collection | string | |
| retourne | Promise<?Object> | the JSON schema of its entities (the Entities tab knows the classes and the schemas) |
explain(call)
asyncmmo-api-console.jhs:222Why a call was refused, or answered an empty list: mmo.oauth's explanation, as the account it was made as.
| call | Object | method, url |
| retourne | Promise<?Object> | what access/explain.json answers, null when the site does not explain |
drawStart()
mmo-api-console.jhs:236Draw the Start tab: how a call is made, what it answers, the errors, the first calls.
setIdentity(identity)
mmo-api-console.jhs:299Who the calls are made as.
| identity | string | session or token |
loginAs()
asyncmmo-api-console.jhs:321Log in as another account, by its password (mmo.oauth's login.json): its token is kept in memory, for this tab; the page's own session is untouched. Not a call of the API: it carries no console header.
| retourne | Promise<void> |
clientLogin()
asyncmmo-api-console.jhs:335Call as an API client: its id and secret exchanged for a token (mmo.oauth's oauth/token, client_credentials), kept in memory -- what the client's own code does. The secret field is emptied.
| retourne | Promise<void> |
fillAccounts()
asyncmmo-api-console.jhs:346Offer the accounts an administrator may call as: the review of the accesses (mmo.oauth), those with a login
callAs()
asyncmmo-api-console.jhs:366Call as an account, for an administrator (mmo.oauth's user/api-token.json: the right to switch account, an account they could manage): a short token, kept in memory.
| retourne | Promise<void> |
askToken(url, headers, body)
asyncmmo-api-console.jhs:382| url | string | |
| headers | Object | |
| body | ?string | |
| retourne | Promise<?Object> | the answer's data (token, expires), null when refused: its reason shown |
useToken(answer, account)
mmo-api-console.jhs:405Make the calls with a token got for an account.
| answer | ?Object | token, expires |
| account | string | its name, for the bar |
headers()
mmo-api-console.jhs:418| retourne | Object | the headers of a call: from the console, a dry run unless live, the token pasted (none for the session: its cookie goes alone) |
site()
mmo-api-console.jhs:426| retourne | string | the site's name, as the bar shows it |
who()
mmo-api-console.jhs:431| retourne | string | who the calls are made as, in words |
drawMode()
mmo-api-console.jhs:437Draw the mode: the banner, and the switch for whoever may go live.
toggleLive()
asyncmmo-api-console.jhs:455Switch between the dry run and live, for whoever may (live): going live is confirmed, by typing the site's name on a production site.
| retourne | Promise<void> |
curlToken()
mmo-api-console.jhs:476| retourne | ?string | the token a copied call shows |
confirmCall(call)
mmo-api-console.jhs:485Asked before a call that may change data.
| call | Object | method, url |
| retourne | Promise<boolean> |
filtered()
mmo-api-console.jhs:494| retourne | Array<Object> | the operations the search and the method keep |
drawNav()
mmo-api-console.jhs:505Draw the list of the operations, by tag.
open(op, values)
mmo-api-console.jhs:541Open an operation, and give it its link.
| op | Object | one of operations |
| values = {} |
openFromHash()
mmo-api-console.jhs:567Open what the address names: an operation (#op=GET /path) or a tab (#tab=entities).
| retourne | boolean | whether it named one |
remember(detail)
mmo-api-console.jhs:587A call just made: marked in the list, remembered in the history (what makes it, never a token nor an answer).
| detail | Object | call, response |
replay(item)
asyncmmo-api-console.jhs:600Open a call remembered: its operation, its values, its query, its body -- not sent.
| item | Object | what the history kept |
| retourne | Promise<void> |