You can update reference sets in the following ways:

  • Add new records
  • Update existing records
  • Add attributes
  • Remove existing attributes

In the upcoming versions, we will make it possible to update existing attributes.

Preconditions

You have uploaded the CSV file to the SFTP server allocated to your Connect subscription. For instructions, see Import reference sets.

Example

Let's say you want to add recent order history records to a reference set in Connect. Columns 1-6 have been added to the reference set before. Column 7 (Return) is a new one.

Order IDClient IDAmountDateFirst-time purchaseDiscount couponReturn
8789645HC-2190012671.702024-11-03T16:04:38ZFALSEFRIENDSN/A
8158122HD-92590022349.002024-11-03T16:04:38ZFALSEWELCOMEFull
8259627HX-51900938650.672024-11-03T15:03:24ZFALSEN/APartial
8134985HX-2590086059.202024-11-02T22:15:38ZFALSEWELCOMEN/A
8548972HE-3781056076.292024-11-02T19:39:55ZFALSEN/AN/A
8991467HA-221001092040.802024-11-02T20:26:13ZFALSEN/AN/A
8614432HE-005004455360.292024-11-02T17:09:56ZFALSEN/APartial
8881448HM-28811560830.602024-11-02T12:35:05ZFALSEN/AN/A

Mutation structure

mutation ($importInput: ImportInput!) {
  createImportJob(importInput: $importInput) {
    id
  }
}
{
  "data": {
    "createImportJob": {
      "id": "1fbe6f9e-572e-4849-1111-00000x00000x"
    }
  }
}

The mutation requires a JSON object. Here is an example if we import columns 1-6 from our sample file with order history.

{
  "importInput": {
    "dataSetId": "3603cf4a-5708-478c-1111-0000000000",
    "jobName": "Add new records 03-11-24",
    "importType": "ADD_UPDATE",
    "fileLocation": {
      "type": "SFTP",
      "filename": "orders-10-31-24.csv",
      "folder": "reference-sets"
    },
    "skipFirstRow": true,
    "mappings": [
      {
        "columnIndex": 1,
        "attributeName": "Order ID"
      },
      {
        "columnIndex": 2,
        "attributeName": "Client ID"
      },
      {
        "columnIndex": 3,
        "attributeName": "Amount"
      },
      {
        "columnIndex": 4,
        "attributeName": "Date"
      },
      {
        "columnIndex": 5,
        "attributeName": "First-time purchase"
      },
      {
        "columnIndex": 6,
        "attributeName": "Discount coupon"
      }
    ],
    "notifications": [
      {
        "channel": "EMAIL",
        "destination": "[email protected]"
      }
    ]
  }
}

To import column 7 (Return), you must create an attribute for it within the same mutation.

{
  "importInput": {
    "dataSetId": "3603cf4a-5708-478c-1111-0000000000",
    "importType": "ADD_UPDATE",
    "jobName": "Add new attribute",
    "fileLocation": {
      "type": "SFTP",
      "filename": "orders-new-data.csv",
      "folder": "reference-sets"
    },
    "mappings": [
      {
        "columnIndex": 1,
        "attributeName": "Order ID"
      },
      {
        "columnIndex": 2,
        "attributeName": "Client ID"
      },
      {
        "columnIndex": 3,
        "attributeName": "Amount"
      },
      {
        "columnIndex": 4,
        "attributeName": "Date"
      },
      {
        "columnIndex": 5,
        "attributeName": "First-time purchase"
      },
      {
        "columnIndex": 6,
        "attributeName": "Discount coupon"
      },
      {
        "columnIndex": 7,
        "attributeName": "Return"
      }
    ],
    "attributes": {
      "create": [
        {
          "name": "Return",
          "type": "TEXT"
        }
      ]
    }
  }
}

Arguments

Arguments required by the createImportJob mutation:

ArgumentValuesDefinition
importInput$importInputA JSON object with import settings

Parameters supported by the importInput object

FieldNested fieldValuesRequired?Definition
attributescreateArray of objectsOptionalCreate an object for each new column you want to import. The column headers will be converted to attributes in Connect.
removeArray of objects Optional Create an object for each column that you want to remove from the reference set.
dataSetIdIDRequiredThe ID of the reference set that you are updating.

- If the reference set is connected to the audience, you can get its ID using the Get connected reference sets mutation.
- If the reference set isn't connected to the audience, copy its ID from the Connect UI.
fileLocationfilenameStringRequiredThe name and extension of the file
folderStringRequiredThe folder or subfolder on the SFTP server where the file is located
typeSFTPRequiredThe method of file delivery
importTypeADD_UPDATERequired The method of file processing.

The ADD_UPDATE method adds new data to an existing reference set.
jobNameStringRequiredThe name you want to assign to the import job
mappingsArray of objectsRequiredCreate an object for each column you want to import to Connect.
notificationschannelEMAILOptionalThe media channel to send the notification through.

Skip this field if you don't want to receive a notification when the import job is complete.
destinationStringOptionalThe email address for notification delivery.

Skip this field if you don't want to receive a notification.
skipFirstRowBoolean. Default value - false. OptionalSet the value to true if the file has a header row.

Input fields supported by objects within the create field

FieldNested fieldValuesRequired?Definition
decimalPrecisionIntegerOptional For numeric attributes, you can specify the number of decimal places after the separator.
nameStringRequiredThe name of the attribute
typeOne of the following values:

- TEXT
- NUMBER
- BOOLEAN
- DATE
RequiredThe data format of the attribute

Input fields supported by objects within the remove field

FieldValuesRequiredDefinition
nameStringRequiredThe name of the attribute to remove from the reference set.

Input fields supported by objects within the mappings field

FieldValuesRequired?Definition
attributeNameStringRequiredThe name of the attribute in the reference set that the column will be mapped to
columnHeaderStringOptionalThe name of the column in the import file.

If you choose to identify the column using columnHeader, do not submit the columnIndex value (it would result in a conflict).
columnIndexIntegerOptional The index number of the column in the import file.

If you choose to identify the column using columnIndex, do not submit the columnHeader value (it would result in a conflict).

Fields

Fields returned by the createImportJob mutation

FieldValuesDefinition
idIDThe ID assigned to the import job