To create a new contact attribute, use the updateDataSet
mutation. You must submit the type of operation (create
) as an argument.
mutation {
updateDataSet(
where: { dataSetId: "4fe4136f-c007-44a3-b38f-92220xxxxxxxx" }
to: {
attributes: {
create: {
name: "Delivery address"
type: TEXT
category: "Contact information"
}
}
}
) {
dataSetId
}
}
{
"data": {
"updateDataSet": {
"dataSetId": "4fe4136f-c007-44a3-b38f-92220xxxxxxxx"
}
}
}
Use an array to create multiple contact attributes simultaneously.
mutation {
updateDataSet(
where: { dataSetId: "4fe4136f-c007-44a3-b38f-92220xxxxxxxx" }
to: {
attributes: {
create: [
{ name: "Last order", type: DATE, category: "Demographic" }
{ name: "Avg. order amount", type: NUMBER, category: "Demographic", decimalPrecision: 0 }
]
}
}
) {
dataSetId
}
}
{
"data": {
"updateDataSet": {
"dataSetId": "4fe4136f-c007-44a3-b38f-92220xxxxxxxx"
}
}
}
Arguments
Arguments required by the updateDataSet
object
Argument name | Nested field | Values | Definition |
---|---|---|---|
where | dataSetId | ID | The ID of the audience to update |
to | attributes | See nested fields | The changes you want to make |
You must nest the create
field into attributes
. Here are the fields you can nest into attributes
> create
.
Nested field - level 1 | Nested field - level 2 | Values | Required? | Definition |
---|---|---|---|---|
name | String (case-sensitive) The name must be unique within the dataset. | Required | The name to assign to the new contact attribute | |
category | String Use the Get all categories query to get the list of supported values. | Optional | The name of a new category for the contact attribute. | |
type | One of the following values: - TEXT - NUMBER - BOOLEAN - DATE | Required | The data format of the attribute | |
decimalPrecision | Integer | Optional | Number of decimal places to display. Applies to numeric attributes | |
identifyAs | channels | One of the following values: - EMAIL - SMS | Required for primary contact information | Marks a phone number or an email as addressable and ties it to a communication channel. |
Note on attributes related to contact information
When creating an attribute for contact information, you can specify which channel it applies to. The attribute will be marked as addressable in the system and tied to consent.
mutation {
updateDataSet(
where: { dataSetId: "4fe4136f-c007-44a3-b38f-92220xxxxxxxx" }
to: {
attributes: {
create: {
name: "Cell phone"
type: TEXT
category: "Contact information"
identifyAs: {
channels: SMS
}
}
}
}
) {
dataSetId
}
}
{
"data": {
"updateDataSet": {
"dataSetId": "4fe4136f-c007-44a3-b38f-92220xxxxxxxx"
}
}
}
Fields
Fields returned the updateDataSet
mutation
Field | Values | Required? | Definition |
---|---|---|---|
dataSetId | ID | Required | The ID of your audience |
Possible error messages
Error code | Definition |
---|---|
ATTRIBUTE_ALREADY_EXISTS | An attribute with the same name is already available. |
ORDERED_ATTRIBUTES_SIZE_EXCEEDED | |
INVALID_ATTRIBUTE_VALUE |