Took another look at this today, thought it be easy to get the “explanation”.
While “request=child” works with issue, some “request=syntax” (e.g. “path=ip,address,add,interface”, see below), cause the entire terminal to terminate (“Console has crashed; please log in again.”) – most things seem to work with request=syntax.
[user@router] > /console/inspect request=syntax path=ip,address,add
Columns: TYPE, SYMBOL, SYMBOL-TYPE, NESTED, NONORM, TEXT
TYPE SYMBOL SYMBOL-TYPE NESTED NONORM TEXT
syntax collection 0 yes
syntax address explanation 1 no Local IP address
syntax broadcast explanation 1 no Broadcast address
syntax comment explanation 1 no Short description of the item
syntax copy-from explanation 1 no Item number
syntax disabled explanation 1 no Defines whether item is ignored or used
syntax interface explanation 1 no Interface name
syntax netmask explanation 1 no Network mask
syntax network explanation 1 no Network prefix
[user@router] > /console/inspect request=syntax path=ip,address,add,address
Columns: TYPE, SYMBOL, SYMBOL-TYPE, NESTED, NONORM, TEXT
TYPE SYMBOL SYMBOL-TYPE NESTED NONORM TEXT
syntax Address definition 0 no A.B.C.D (IP address)
[user@router] > /console/inspect request=syntax path=ip,address,add,interface
Console has crashed; please log in again.
Even wrapping it a “:do {} on-error={}” does NOT catch the crash so that didn’t work to avoid the issue.
:do {
/console/inspect request=syntax path=ip,address,add,interface
} on-error={:put "got error"}
While that would not be critical for schema per-se, it does have a description to set, and there is some “collection” node-type that likely indicates an possible array (instead of just string) as JSON param.
FWIW you can call the same /console/inspect via REST API too. But the same params in REST "{ “request”: “syntax”, “path”: “ip,address,add,interface” } while don’t “crash” it timeouts with no data (empty JSON array).
In fact, here the RAML for just the /console/inspect:
#%RAML 1.0
title: ROS.RAML sample
version: 7.6
protocols: [HTTPS]
mediaType: [application/json]
securitySchemes:
basic:
description: |
Mikrotik REST API only supports Basic Authentication, secured by HTTPS
type: Basic Authentication
securedBy: [basic]
baseUri: https://{host}:{port}/rest
baseUriParameters:
host:
description: RouterOS device IP or host name
default: "192.168.88.1"
port:
description: RouterOS https port to use
default: "443"
documentation:
- title: RouterOS RAML Schema
content: |
Schema is generated using `/console/inspect` on a RouterOS devices and
interpreted into a schema based on the rules in
[Mikrotik REST documentation](https://help.mikrotik.com)
- title: Demo Only
content: We just try a few commands
/console:
/inspect:
post:
description: Inspects the RouterOS AST
body:
application/json:
type: object
properties:
.proplist?:
type: string
description: List of properties to return (see RouterOS docs)
.query?:
type: string
description: List of properties to return (see RouterOS docs)
path?:
type: string
description: Comma-seperated string of RouterOS path
example:
input?:
type: string
request:
type: string
enum: [self|child|completion|highlight|syntax|error]
example:
path: "ip,address,add,interface"
request: syntax
responses:
200:
body:
application/json:
type: array