アクション一覧
指定した環境で利用できるアクションの一覧を取得します。レスポンスには各アクションの引数スキーマも含まれるため、このAPIだけでアクション実行に必要な情報をまとめて取得できます。
エンドポイント
GET /projects/{project_id}/environments/{environment_id}/actions認証・共通ヘッダー・エラー形式は公開APIとはを参照してください。
パスパラメータ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
project_id | string | 必須 | 対象プロジェクトのID |
environment_id | string | 必須 | 対象環境のID |
クエリパラメータ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
limit | integer | 任意 | 1ページあたりの取得件数。1〜100、デフォルト20 |
cursor | string | 任意 | 前ページのレスポンスのnext_cursorを不透明な値としてそのまま指定する(^[A-Za-z0-9+/=_-]+$) |
リクエスト例
curl https://platform.basemachina.com/public/v1/projects/csi2hcc0iaejrqgivkfg/environments/9m4e2mr0ui3e8a215n4g/actions \
-H "Authorization: Bearer $BM_TOKEN"レスポンス
ステータス200 OKで、以下のenvelope形式が返ります。
{
"data": [
{
"id": "send_email",
"name": "メール送信",
"description": "ユーザーにメール本文を送信する",
"input_schema": {
"type": "object",
"properties": {
"user_id": {
"type": "string",
"description": "ユーザーID",
"x-basemachina-input-type": "text"
},
"subject": {
"type": "string",
"x-basemachina-input-type": "text"
},
"body": {
"type": "string",
"x-basemachina-input-type": "text",
"x-basemachina-multiline": true
}
},
"required": ["user_id", "subject", "body"],
"additionalProperties": false
}
}
],
"has_more": false
}has_moreがtrueのときは、レスポンスにnext_cursorが含まれます。has_moreがfalseの場合、next_cursorは省略されます。次ページの取得情報はレスポンスボディのみで提供され、Linkなどのヘッダーは付与されません。
envelopeのフィールド
| フィールド | 型 | 説明 |
|---|---|---|
data | array | アクションリソースの配列。最大100件 |
has_more | boolean | 次ページが存在するかどうか |
next_cursor | string | 次ページ取得用のカーソル。has_moreがtrueの場合のみ含まれる |
data[]の各フィールド
| フィールド | 型 | 説明 |
|---|---|---|
id | string | アクションの識別子。実行時のパスパラメーターに使用する |
name | string | 管理画面に表示されるアクション名 |
description | string | アクションの説明文 |
input_schema | object | 引数のJSON Schema(2020-12 draft)。後述の引数スキーマを参照 |
無効化されたアクションは
data[]に含まれません。引数スキーマ(input_schema)
input_schemaはJSON Schema 2020-12形式です。ベースマキナ独自の入力タイプはx-basemachina-input-typeをdiscriminatorとして表現されます。
| ベースマキナの入力タイプ | JSON Schemaでの表現 |
|---|---|
| テキスト | { "type": "string", "x-basemachina-input-type": "text" }(pattern、minLength、maxLength、enumなどの制約がつく場合あり) |
| 数値 | { "type": "number", "x-basemachina-input-type": "number" }(minimum、maximum、enumなどの制約がつく場合あり) |
| 真偽値 | { "type": "boolean", "x-basemachina-input-type": "bool" } |
| 日時 | { "type": "string", "format": "date-time", "x-basemachina-input-type": "date" }(日付のみの場合はformat: "date") |
| SQL | { "type": "string", "format": "sql", "x-basemachina-input-type": "sql" } |
| ファイル | { "type": "string", "contentEncoding": "base64", "contentMediaType": "image/png", "x-basemachina-input-type": "file", "readOnly": true } |
| JSON値(テキスト) | { "type": "string", "x-basemachina-input-type": "json_text" } |
| JSON値(数値) | { "type": "number", "x-basemachina-input-type": "json_number" } |
| JSON値(日時) | { "type": "string", "format": "date-time", "x-basemachina-input-type": "json_date" }(日付のみの場合はformat: "date") |
| 配列 | { "type": "array", "x-basemachina-input-type": "array", "items": {...} } |
| タプル | { "type": "array", "x-basemachina-input-type": "tuple", "prefixItems": [...], "minItems": N, "maxItems": N } |
enum制約付きのテキスト・数値・SQL入力では、表示用ラベルがx-basemachina-select-labelsに格納されることがあります。
{
"type": "string",
"enum": ["admin", "member"],
"x-basemachina-select-labels": { "admin": "管理者", "member": "一般" }
}エラー
| ステータス | code | 発生条件 |
|---|---|---|
401 | unauthorized | Authorizationヘッダー欠落・トークン検証失敗 |
422 | argument_invalid | limitが範囲外、cursorの形式不正など、クエリパラメータの値が不正 |
500 | internal_error | gatewayまたは内部APIの障害 |
エラーコードの詳細は公開APIとはを参照してください。