MMOframework
Pourquoi l'IA Playground Bibliothèques Développeurs Agence
FR EN
Créer un projet en direct
Index

mmo-api-console

1 symbole · générée le 30 Nov 2026

element

mmo-api-console

mmo-api-console.jhs:1

A 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.

<mmo-api-console url token live production schemas diagram></mmo-api-console>
Étend
CustomShadowElement
Every call is a dry run (`X-MMO-Dry-Run: 1`, mmo.core's DryRun): the server answers what it would, and changes nothing -- a banner always says so, an answer says what would have changed. A holder of the right to call live (`live`) can switch to Live for this tab, after a confirmation; the banner then warns the data is real. Every call says it comes from the console (`X-MMO-Console: 1`): a server refuses it live to whoever lacks the right.
<mmo-api-console url="https://example.com/api.json"></mmo-api-console>

Index

urlthe OpenAPI document (MMO.url('api.json') by default)
tokenthe token a copied curl shows for the session (the page gives it, or nothing: $TOKEN)
livepresent when the user may call the API live from the console (mmo.oauth: the scope api.live)
productionpresent on a production site: going live asks to type the site's name
schemasthe JSON schemas of the entities (MMO.url('data/schemas.json') by default), for the Entities tab and the data api's query builder
diagraman 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() asyncLoad 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) asyncWhy 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() asyncLog 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() asyncCall 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() asyncOffer the accounts an administrator may call as: the review of the accesses (mmo.oauth), those with a login
callAs() asyncCall 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() asyncSwitch 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) asyncOpen a call remembered: its operation, its values, its query, its body -- not sent.

Attributs6

token

mmo-api-console.jhs

the token a copied curl shows for the session (the page gives it, or nothing: $TOKEN)

token

live

mmo-api-console.jhs

present when the user may call the API live from the console (mmo.oauth: the scope api.live)

live

production

mmo-api-console.jhs

present on a production site: going live asks to type the site's name

production

schemas

mmo-api-console.jhs

the 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.jhs

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-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

showTab(tab, link)

mmo-api-console.jhs:171

Show a tab.

showTab(tab, link = true)
tabstringstart, operations, entities
link = truebooleangive it its address (#tab=...)

openOperation(method, path, values)

mmo-api-console.jhs:199

Open an operation by its method and path, its parameters filled in.

openOperation(method, path, values = {})
methodstring
pathstring
values = {}Object
retournebooleanwhether the document has it

schemaOf(collection)

asyncmmo-api-console.jhs:210
async schemaOf(collection)
collectionstring
retournePromise<?Object>the JSON schema of its entities (the Entities tab knows the classes and the schemas)

explain(call)

asyncmmo-api-console.jhs:222

Why a call was refused, or answered an empty list: mmo.oauth's explanation, as the account it was made as.

async explain(call)
callObjectmethod, url
retournePromise<?Object>what access/explain.json answers, null when the site does not explain

drawStart()

mmo-api-console.jhs:236

Draw the Start tab: how a call is made, what it answers, the errors, the first calls.

drawStart()

setIdentity(identity)

mmo-api-console.jhs:299

Who the calls are made as.

setIdentity(identity)
identitystringsession or token

loginAs()

asyncmmo-api-console.jhs:321

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. Not a call of the API: it carries no console header.

async loginAs()
retournePromise<void>

clientLogin()

asyncmmo-api-console.jhs:335

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. The secret field is emptied.

async clientLogin()
retournePromise<void>

fillAccounts()

asyncmmo-api-console.jhs:346

Offer the accounts an administrator may call as: the review of the accesses (mmo.oauth), those with a login

async fillAccounts()

callAs()

asyncmmo-api-console.jhs:366

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.

async callAs()
retournePromise<void>

askToken(url, headers, body)

asyncmmo-api-console.jhs:382
async askToken(url, headers, body)
urlstring
headersObject
body?string
retournePromise<?Object>the answer's data (token, expires), null when refused: its reason shown

useToken(answer, account)

mmo-api-console.jhs:405

Make the calls with a token got for an account.

useToken(answer, account)
answer?Objecttoken, expires
accountstringits name, for the bar

headers()

mmo-api-console.jhs:418
headers()
retourneObjectthe headers of a call: from the console, a dry run unless live, the token pasted (none for the session: its cookie goes alone)

toggleLive()

asyncmmo-api-console.jhs:455

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.

async toggleLive()
retournePromise<void>

confirmCall(call)

mmo-api-console.jhs:485

Asked before a call that may change data.

confirmCall(call)
callObjectmethod, url
retournePromise<boolean>

open(op, values)

mmo-api-console.jhs:541

Open an operation, and give it its link.

open(op, values = {})
opObjectone of operations
values = {}

openFromHash()

mmo-api-console.jhs:567

Open what the address names: an operation (#op=GET /path) or a tab (#tab=entities).

openFromHash()
retournebooleanwhether it named one

remember(detail)

mmo-api-console.jhs:587

A call just made: marked in the list, remembered in the history (what makes it, never a token nor an answer).

remember(detail)
detailObjectcall, response

replay(item)

asyncmmo-api-console.jhs:600

Open a call remembered: its operation, its values, its query, its body -- not sent.

async replay(item)
itemObjectwhat the history kept
retournePromise<void>