ルックアップ作成
新しいルックアップを作成します。本操作には管理者権限が必要です。
HTTPリクエスト
POST /api/sonar/lookups
cURL例
curl -H "Authorization: Bearer <API_KEY>" \
-d name=country_code \
-d description="国コードの日本語名マッピング" \
-d fields="[{""field_name"":"country_code",""len"":2,""use_null"":false},{""field_name"":""name"",""len"":255,""use_null"":false}]"
-X POST https://HOSTNAME/api/sonar/lookups
リクエストパラメータ
| キー | 必須 | 型 | 説明 | 備考 |
|---|---|---|---|---|
| guid | X | 文字列 | ルックアップGUID | 36文字。デフォルトはランダム生成 |
| name | O | 文字列 | ルックアップ名 | 最小0文字、最大240文字。英数字およびアンダースコアのみ使用可 |
| description | X | 文字列 | ルックアップ説明 | 最大2000文字 |
| fields | O | オブジェクト配列 | フィールド定義リスト | 以下のfieldsオブジェクト属性を参照 |
fieldsオブジェクト属性
| キー | 必須 | 型 | 説明 |
|---|---|---|---|
| field_name | O | 文字列 | フィールド名 |
| len | O | 32ビット整数 | 値の最大長 |
| use_null | O | ブール値 | 空値の許容可否 |
正常レスポンス
{
"guid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
エラーレスポンス
必須パラメータが不足している場合
HTTPステータスコード 400 のレスポンス
{
"error_code": "null-argument",
"error_msg": "name should be not null"
}
パラメータ値の長さが不正な場合
HTTPステータスコード 400 のレスポンス
{
"error_code": "invalid-argument",
"error_msg": "'name' must be shorter than or equal to 240 characters."
}
ルックアップ名に許可されていない文字が含まれている場合
HTTPステータスコード 400 のレスポンス
{
"error_code": "illegal-state",
"error_msg": "lookup name must be alphanumeric and underscore characters only: hello-world"
}
ルックアップ名が重複している場合
HTTPステータスコード 500 のレスポンス
{
"error_code": "illegal-state",
"error_msg": "duplicated lookup name: country_code"
}
ルックアップ作成権限がない場合
HTTPステータスコード 500 のレスポンス
{
"error_code": "illegal-state",
"error_msg": "no-permission"
}