データベーステーブルの作成
データベーステーブルの作成
このAPIを使用するとエージェント用の新しいデータベーステーブルとそのフィールドを作成できます。
リクエストメソッド
POST
エンドポイント
https://api-${endpoint}.gptbots.ai/v1/database/create-table
認証
認証方法の説明についてはAPI Overviewをご参照ください。
リクエスト
リクエスト例
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/database/create-table' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"name": "test_api",
"description": "Test all database APIs",
"fields": [
{
"name": "id",
"description": "id",
"type": "TEXT",
"required": true,
"unique": true
},
{
"name": "boolean",
"description": "boolean",
"type": "BOOLEAN",
"required": true,
"unique": false
},
{
"name": "int",
"description": "int",
"type": "INT",
"required": true,
"unique": true
},
{
"name": "datetime",
"description": "datetime",
"type": "DATETIME",
"required": true,
"unique": false
},
{
"name": "float",
"description": "float",
"type": "FLOAT",
"required": false,
"unique": false
}
]
}'
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/database/create-table' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"name": "test_api",
"description": "Test all database APIs",
"fields": [
{
"name": "id",
"description": "id",
"type": "TEXT",
"required": true,
"unique": true
},
{
"name": "boolean",
"description": "boolean",
"type": "BOOLEAN",
"required": true,
"unique": false
},
{
"name": "int",
"description": "int",
"type": "INT",
"required": true,
"unique": true
},
{
"name": "datetime",
"description": "datetime",
"type": "DATETIME",
"required": true,
"unique": false
},
{
"name": "float",
"description": "float",
"type": "FLOAT",
"required": false,
"unique": false
}
]
}'
このコードブロックをポップアップで表示
リクエストヘッダー
| フィールド | タイプ | 説明 |
|---|---|---|
| Authorization | Bearer ${API Key} | 認証には Authorization: Bearer ${API Key} を使用してください。トークンはAPIキーページから取得できます。 |
| Content-Type | application/json | データ形式は application/json を指定してください。 |
リクエストボディ
| フィールド | タイプ | 必須 | 説明 |
|---|---|---|---|
| name | String | 必須 | テーブル名:64文字以内、小文字アルファベット・数字・アンダースコアを使用し、英字で始める必要があります。 |
| description | String | 必須 | テーブルの説明:128文字以内。LLMがテーブルのデータ構造を理解するための補助情報です。 |
| fields | Array | 必須 | テーブルフィールドの配列 |
| fields[].name | String | 必須 | フィールド名:64文字以内、小文字アルファベット・数字・アンダースコアが使用可能です。 |
| fields[].description | String | 必須 | フィールドの説明:128文字以内。LLMがフィールドの意味や構造を理解するための補助情報です。 |
| fields[].type | String | 必須 | データ型:TEXT/INT/FLOAT/DATETIME/BOOLEANのいずれか。 |
| fields[].required | Boolean | 任意 | 必須入力項目:true/false |
| fields[].unique | Boolean | 任意 | 一意制約(Unique: true) |
レスポンス
レスポンス例
"673e9c7a9f7bc178002dbce8"
"673e9c7a9f7bc178002dbce8"
このコードブロックをポップアップで表示
成功応答
| フィールド | 型 | 説明 |
|---|---|---|
| code | int | メッセージのタイプコード。 |
| message | string | メッセージの説明。 |
| data | object | 応答内容。データテーブルの一意な識別子。 |
失敗応答
| フィールド | 型 | 説明 |
|---|---|---|
| code | int | エラーコード。 |
| message | string | エラーの詳細。 |
エラーコード
| Code | Message |
|---|---|
| 40000 | パラメータエラー |
| 40008 | Agent RPM リクエストが制限を超えました。制限を引き上げるにはサービスプロバイダーにお問い合わせください。 |
| 40127 | 開発者認証に失敗しました |
| 40353 | この機能は上位プランにアップグレードすると利用可能です |
| 403100 | テーブル名が無効です |
| 403103 | フィールド名が無効です |
| 50000 | システム内部エラー |
