リファレンス
ここは見取り図です
個々のコマンドの詳細は --help に載っています。 エンドポイントの説明文と パラメータは公式の OpenAPI 定義と同じ内容なので、このサイトに転記しても 古くなるだけです。全体を1つの Markdown で読みたいときは mtb llm を使います。
bash
mtb sites entries --help # ぶら下がっている操作
mtb sites entries list --help # パラメータ(公式の説明文つき)
mtb llm # 詳細リファレンス(埋め込み)見取り図
| コマンドの命名規則 | パスからコマンド名を導く規則と、7つの例外 |
| 共通フラグ | どのコマンドでも使えるフラグ |
| 終了コード | 失敗の分類。スクリプトはこのコードで処理を分岐する |
| 環境変数と設定ファイル | 設定の置き場所と優先順位 |
コマンドの大枠
コマンド名は Data API のパスと1対1で対応します。
GET /v7/sites/{site_id}/entries mtb sites entries list
POST /v7/sites/{site_id}/entries mtb sites entries create
GET /v7/sites/{site_id}/entries/{entry_id} mtb sites entries get
PUT /v7/sites/{site_id}/entries/{entry_id} mtb sites entries update
DELETE /v7/sites/{site_id}/entries/{entry_id} mtb sites entries delete
POST /v7/assets/upload mtb assets upload主なグループは次のとおりです(全グループは mtb --help で確認できます)。
| グループ | 中身 |
|---|---|
mtb sites ... | サイト配下のほとんどのリソース(記事・ページ・カテゴリ・テンプレート・アセット・権限…) |
mtb assets upload | アップロード(site_id は本文で渡す) |
mtb users / groups / roles | 利用者・グループ・ロール |
mtb publish | 再構築 |
mtb search | MT のサイト内検索(公開済みのものだけが対象) |
mtb text-filters / plugins / endpoints / themes | サーバの構成情報 |
mtb dump | 環境間の差分を取るための書き出し |
mtb auth / profile | 認証と接続先(MT には送らない) |
mtb api | 定義に無いエンドポイントを呼び出す |
mtb llm | 埋め込みリファレンスの出力 |
エンドポイントではないコマンド
Data API に無い操作を mtb 側で実装したコマンドです。公式リファレンスには 対応するパスがありません。
| コマンド | 中身 |
|---|---|
mtb auth login / logout / refresh / status | /authentication /token のラッパー |
mtb profile ... | 接続先の設定 |
mtb api <メソッド> <パス> | 任意のエンドポイントを直接呼び出す回避策 |
mtb llm | 埋め込みリファレンスの表示 |
mtb sites templates pull / push | 一覧の取得と更新を繰り返して、テンプレートをディレクトリへ書き出し、ディレクトリから書き戻す |
mtb dump | 種類ごとの YAML への書き出し |
サーバが実際に持つ機能の確認
仕様に載っていてもサーバに無い機能があり、プラグインが追加した機能もあります。
bash
mtb endpoints list --all --fields component,verb,route
mtb api GET /sites/1/things --all --fields id,label