To start taking advantage of the data in your reference sets, you must connect them to your audience and — if necessary — to each other.
In the example below, we map the Last Order ID audience attribute to the ID attribute in the Order History reference set. This will enable Connect to pull order details for each client.
mutation {
addReferenceSetAssociation(
dataSetAssociation: {
to: "b4fc145e-680a-4fc6-9d7a-00000000001"
from: "a7c170d2-51d5-4c86-9a28-000000au1"
mappings: { toAttribute: "ID", fromAttribute: "Last Order ID" }
}
) {
to {
name
dataSetId
type
}
from {
name
dataSetId
type
}
}
}
{
"data": {
"addReferenceSetAssociation": {
"to": {
"name": "Order history",
"dataSetId": "b4fc145e-680a-4fc6-9d7a-00000000001",
"type": "REFERENCE_SET"
},
"from": {
"name": "Marketing",
"dataSetId": "a7c170d2-51d5-4c86-9a28-000000au1",
"type": "AUDIENCE"
}
}
}
}
How it works
- You can connect the audience to a reference set that is connected to another reference set. Unlike the audience, reference sets support only one-level connections.
- Connections are established based on a common attribute. The source and destination attributes must be of the same type (for example, text/text or date/date). To learn more about the options, see our marketing guide - Create connections.
Running the mutation
If you haven't used our API before, see Using the Connect API for instructions. It explains how to authenticate your calls and suggests some tools for testing.
Mutation structure
Arguments
The addReferenceSetAssociation
mutation has the dataSetAssociation
argument at the top level. Here are the input fields supported by the argument. All of them are required.
Field | Nested field | Values | Definition |
---|---|---|---|
to | ID | The ID of the target data set | |
from | ID | The ID of the source data set. ⚠️If you are connecting a resource set to the audience, the audience is always the source data set. It cannot be a target data set. | |
mappings | toAttribute | String | The attribute in the target data set to use for mapping |
fromAttribute | String | The attribute in the source data set to use for mapping |
Fields
Fields returned by the addReferenceSetAssociation
mutation
Field | Nested field | Values | Required? | Definition |
---|---|---|---|---|
to | dataSetId | ID | Required | The ID of the target data set |
name | String | Optional | The name of the target data set | |
type | Enumeration. Valid values: - AUDIENCE - REFERENCE_SET | Optional | The type of the target data set | |
from | dataSetId | ID | Required | The ID of the source data set |
name | String | Optional | The name of the source data set | |
type | Enumeration. Valid values: - AUDIENCE - REFERENCE_SET | Optional | The type of the source data set |