スキル一覧に戻る
psh-inc

metabase-api-skill

by psh-inc

0🍴 0📅 2026年1月24日
GitHubで見るManusで実行

SKILL.md


name: metabase-api-skill description: | Add, manage, and execute SQL scripts in self-hosted Metabase via REST API. Supports creating cards/questions, running queries, and managing collections. Use when: Creating Metabase dashboards programmatically, automating report generation, managing SQL questions/cards via API, or integrating Metabase with the casino platform. allowed-tools: Read, Edit, Write, Glob, Grep, Bash

Metabase API Skill

This skill covers programmatic interaction with Metabase's REST API for the casino platform. Use it for creating SQL-based cards (questions), managing collections, running ad-hoc queries, and automating dashboard creation. The casino platform uses Metabase for affiliate reporting (CellExpert metrics), player analytics, and transaction reporting.

Quick Start

Authentication

# Get session token
curl -X POST https://metabase.example.com/api/session \
  -H "Content-Type: application/json" \
  -d '{"username": "admin@casino.com", "password": "secret"}'

# Response: {"id": "session-token-here"}

Create a SQL Card

curl -X POST https://metabase.example.com/api/card \
  -H "Content-Type: application/json" \
  -H "X-Metabase-Session: ${SESSION_TOKEN}" \
  -d '{
    "name": "Player Deposits by Currency",
    "dataset_query": {
      "type": "native",
      "native": {
        "query": "SELECT currency, SUM(amount) as total FROM transactions WHERE type = '\''DEPOSIT'\'' GROUP BY currency",
        "template-tags": {}
      },
      "database": 1
    },
    "display": "bar",
    "visualization_settings": {},
    "collection_id": 5
  }'

Key Concepts

ConceptUsageExample
CardA saved question/querySQL or GUI-based query
CollectionFolder for organizing cardscollection_id: 5
DatabaseConnected data sourcePostgreSQL casino DB
DashboardContainer for multiple cardsPlayer Overview
Template TagsParameterized queries{{player_id}}

Common Patterns

Execute Ad-hoc Query

When: Running one-off queries for debugging or data exploration

curl -X POST https://metabase.example.com/api/dataset \
  -H "Content-Type: application/json" \
  -H "X-Metabase-Session: ${SESSION_TOKEN}" \
  -d '{
    "database": 1,
    "type": "native",
    "native": {
      "query": "SELECT * FROM players WHERE id = {{player_id}}",
      "template-tags": {
        "player_id": {"type": "number", "name": "player_id", "display-name": "Player ID"}
      }
    },
    "parameters": [{"type": "number", "target": ["variable", ["template-tag", "player_id"]], "value": 12345}]
  }'

List Collections

When: Finding where to place new cards

curl -X GET https://metabase.example.com/api/collection \
  -H "X-Metabase-Session: ${SESSION_TOKEN}"

See Also

  • patterns - Card creation, query optimization, error handling
  • workflows - Dashboard automation, report scheduling
  • See the postgresql skill for SQL query optimization and schema design
  • See the spring-boot skill for backend API integration with Metabase

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です