Skip to main content

Add data type

post
/api/pvlt/1.0/ctl/types

Adds a data type.

The role performing this operation must have the CapTypesWriter capability. See Access control for more information about how capabilities are used to control access to operations.

Request

Request body

Details of the data type, including the names and locations of the JavaScript functions it uses.

object required*

The data type and its function. default_transformer is the default transformer for the data type and should be taken from the transformers list.

  • name - string required*

    The name of a data type.

  • is_builtin - boolean

    Whether this data type is built-in or user defined.

  • base_type_name - string required*

    The name of a data type.

  • description - string

    The description of a model.

  • validator - string

    The bundle and function name formatted as <bundle-name>.<function-name>.

  • normalizer - string

    The bundle and function name formatted as <bundle-name>.<function-name>.

  • transformers - array of strings

    The names of transformers that are supported for the data type.

    Each string:

    The bundle and function name formatted as <bundle-name>.<function-name>.

  • default_transformer - string

    The bundle and function name formatted as <bundle-name>.<function-name>.

Example
{
"name": "student_id",
"base_type_name": "STRING",
"description": "A custom data type representing a student ID based on the built-in STRING type.",
"validator": "example_bundle.validate_student_id",
"normalizer": "example_bundle.normalize_student_id",
"transformers": [
"example_bundle.format_student_id",
"example_bundle.mask_first_4_digits"
],
"default_transformer": "example_bundle.format_student_id"
}

Possible responses

The request is successful.

object required*

The data type and its function. default_transformer is the default transformer for the data type and should be taken from the transformers list.

  • name - string required*

    The name of a data type.

  • is_builtin - boolean

    Whether this data type is built-in or user defined.

  • base_type_name - string required*

    The name of a data type.

  • description - string

    The description of a model.

  • validator - string

    The bundle and function name formatted as <bundle-name>.<function-name>.

  • normalizer - string

    The bundle and function name formatted as <bundle-name>.<function-name>.

  • transformers - array of strings

    The names of transformers that are supported for the data type.

    Each string:

    The bundle and function name formatted as <bundle-name>.<function-name>.

  • default_transformer - string

    The bundle and function name formatted as <bundle-name>.<function-name>.

  • creation_time - string

    The time when the data type was created.

Example
{
"name": "student_id",
"base_type_name": "STRING",
"description": "A custom data type representing a student ID based on the built-in STRING type.",
"validator": "example_bundle.validate_student_id",
"normalizer": "example_bundle.normalize_student_id",
"transformers": [
"example_bundle.format_student_id",
"example_bundle.mask_first_4_digits"
],
"default_transformer": "example_bundle.format_student_id",
"creation_time": "2022-12-01T10:04:42.777225Z"
}

Try the API

Authorization

Request body

Navigate to the docs of your local Vault installation to try the API directly from there.

Code examples

Example