Create attribute definition
POST
/workspaces/{workspaceId}/attribute-definitions
This endpoint is used to create a new attribute definition for all contacts in a workspace.
A contact attribute definition is used to define the attributes that a contact can have.
Treść żądania
key
string
wymagane
A user-specified key, primarily for client reference.
displayName
string
wymagane
A human-readable name of the attribute.
description
string
A user-friendly description of the attribute.
cardinality
string
wymagane
The cardinality configures how many values belong to the single key.
Possible values: one, many
type
string
wymagane
Possible values: boolean, datetime, number, string
format
object
Pokaż parametry podrzędne
format.type
string
wymagane
Possible values: emailAddress
format.type
string
wymagane
Possible values: phoneNumber
format.select
object
wymagane
Pokaż parametry podrzędne
format.select.options
array of object
wymagane
Pokaż parametry podrzędne
format.select.options.label
string
wymagane
Human-friendly label for the option
format.select.options.value
string
wymagane
Immutable string that will be stored in contact attributes
format.type
string
wymagane
Possible values: select
format.type
string
wymagane
Possible values: uuid
format.multiline
boolean
format.type
string
wymagane
Possible values: text
format.type
string
wymagane
Possible values: url
format.type
string
wymagane
Possible values: date
format.scale
integer
format.type
string
wymagane
Possible values: numberScale
pii
boolean
wymagane
A flag to indicate whether this attribute is considered personally identifiable information.
readOnly
boolean
wymagane
A flag to indicate whether this attribute may be updated after creation.
indexMapping
object
Pokaż parametry podrzędne
indexMapping.fields
array of object
Pokaż parametry podrzędne
indexMapping.fields.name
string
indexMapping.fields.analyzer
string
Possible values: simple, standard, web, keyword, en, emailDomain, dayOfYear
indexMapping.fields.type
string
Possible values: string
acl
array of object
An array of ACLs that define the access control for this attribute
Pokaż parametry podrzędne
acl.roleId
string
The UUID role ID
acl.read
boolean
A flag to indicate role read access
acl.write
boolean
A flag to indicate role write access
Treść odpowiedzi
id
string
The UUID, primarily for internal reference
key
string
A user-specified key, primarily for client reference.
displayName
string
A human-readable name of the attribute.
description
string
A user-friendly description of the attribute.
cardinality
string
The cardinality configures how many values belong to the single key.
Possible values: one, many
type
string
The data type of the attribute.
Possible values: boolean, datetime, number, string
format
object
Pokaż atrybuty podrzędne
format.type
string
wymagane
Possible values: emailAddress
format.type
string
wymagane
Possible values: phoneNumber
format.select
object
wymagane
Pokaż atrybuty podrzędne
format.select.options
array of object
wymagane
Pokaż atrybuty podrzędne
format.select.options.label
string
wymagane
Human-friendly label for the option
format.select.options.value
string
wymagane
Immutable string that will be stored in contact attributes
format.type
string
wymagane
Possible values: select
format.type
string
wymagane
Possible values: uuid
format.multiline
boolean
format.type
string
wymagane
Possible values: text
format.type
string
wymagane
Possible values: url
format.type
string
wymagane
Possible values: date
format.scale
integer
format.type
string
wymagane
Possible values: numberScale
pii
boolean
A flag to indicate whether this attribute is considered personally identifiable information.
readOnly
boolean
A flag to indicate whether this attribute may be updated after creation.
builtin
boolean
A flag to indicate whether this attribute is built-in. Built-in attributes are system-defined
and cannot be updated or deleted by end-users.
archived
boolean
A flag to indicate whether this attribute is archived.
indexMapping
object
Pokaż atrybuty podrzędne
indexMapping.fields
array of object
Pokaż atrybuty podrzędne
indexMapping.fields.name
string
indexMapping.fields.analyzer
string
Possible values: simple, standard, web, keyword, en, emailDomain, dayOfYear
indexMapping.fields.type
string
Possible values: string
createdAt
string
updatedAt
string
version
number
The version number of the attribute definition.
acl
array of object
An array of ACLs that define the access control for this attribute
Pokaż atrybuty podrzędne
acl.roleId
string
The UUID role ID
acl.read
boolean
A flag to indicate role read access
acl.write
boolean
A flag to indicate role write access
Przykład kodu
curl -X POST 'https://api.bird.com/workspaces/{workspaceId}/attribute-definitions' \
-H 'Authorization: AccessKey YOUR_ACCESS_KEY'Examples
Let's establish some of our data that will be used in the following examples:
- Workspace ID: a1405560-c8d3-4b1a-877d-3f449ad95352
- AccessKey: abcd
Create an attribute definition
In this example, we're creating a basic attribute definition.
Przykład kodu
curl -X POST "https://api.bird.com/workspaces/a1405560-c8d3-4b1a-877d-3f449ad95352/attribute-definitions" \
-H "Content-Type: application/json" \
-H "Authorization: AccessKey abcd" \
-d '{
"type": "string",
"key": "countryCode",
"displayName": "countryCode",
"description": "Country code",
"pii": false,
"cardinality": "one",
"readOnly": false
}'Przykład kodu
{
"key": "countryCode",
"displayName": "countryCode",
"description": "Country code",
"cardinality": "one",
"type": "string",
"pii": false,
"readOnly": false,
"builtin": false,
"archived": false,
"createdAt": "2024-11-26T15:00:00.000Z",
"updatedAt": "2024-11-26T15:00:00.000Z",
"group": "custom"
}Create an attribute definition with a format
In this example, we're creating an attribute definition and prodivding a format in order to validate the value.
Przykład kodu
curl -X POST "https://api.bird.com/workspaces/a1405560-c8d3-4b1a-877d-3f449ad95352/attribute-definitions" \
-H "Content-Type: application/json" \
-H "Authorization: AccessKey abcd" \
-d '{
"type": "string",
"key": "countryCode",
"displayName": "countryCode",
"description": "Country code",
"pii": false,
"cardinality": "one",
"readOnly": false
"format": {
"type": "select",
"select": {
"options": [
{
"label": "US",
"value": "US"
},
{
"label": "BR",
"value": "BR"
}
]
}
}
}'Przykład kodu
{
"key": "countryCode",
"displayName": "countryCode",
"description": "Country code",
"cardinality": "one",
"type": "string",
"pii": false,
"readOnly": false,
"builtin": false,
"archived": false,
"createdAt": "2024-11-26T15:00:00.000Z",
"updatedAt": "2024-11-26T15:00:00.000Z",
"group": "custom",
"format": {
"type": "select",
"select": {
"options": [
{
"label": "US",
"value": "US"
},
{
"label": "BR",
"value": "BR"
}
]
}
}
}