Create Lookup

Creates a new lookup. This operation requires administrator role.

Required Permissions

Requires the ADMIN role or higher.

HTTP Request

POST /api/sonar/lookups
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d name=country_code \
     -d description="Country code to Korean name mapping" \
     -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
Request Parameters
KeyRequiredTypeDescriptionNotes
guidNStringLookup GUID36 characters. Default: randomly generated
nameYStringLookup nameMin 0, max 240 characters. Alphanumeric and underscore only
descriptionNStringLookup descriptionMax 2000 characters
fieldsYObject arrayField definition listSee fields object properties below

fields object properties

KeyRequiredTypeDescription
field_nameYStringField name
lenY32-bit integerMaximum value length
use_nullYBooleanWhether empty values are allowed

Success Response

HTTP status code 200 response

{
  "guid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Error Responses

name parameter is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "name should be not null"
}
name parameter length is invalid

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'name' must be shorter than or equal to 240 characters."
}
description parameter length is invalid

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'description' must be shorter than or equal to 2000 characters."
}
guid is not a valid GUID

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "guid should be guid type."
}
name: invalid characters

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "lookup name must be alphanumeric and underscore characters only: hello-world"
}
Field name contains a character that is not allowed

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "lookup field name must be alphanumeric and underscore characters only: field-1"
}
Field name is duplicated

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "duplicated lookup field name: country"
}
Field maximum length is out of range

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "max length of the field must be between 1 and 2000: field country, len 0"
}
A reserved field name is used

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "this field name is a reserved word: created"
}
name: duplicate lookup name

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "duplicated lookup name: country_code"
}
Lookup GUID is duplicated

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "duplicated lookup guid: 76b8699d-91a1-4576-a908-7db753570a0a"
}
Permission denied

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "no-permission"
}