Merge supplemental table records using primary key

For an existing supplemental table, you can add new members or update data for existing members.

REQUEST NOTES:

  • For a given supplemental table in a specific folder, you must specify an array of record data that contains field names and their corresponding field values along with ALL primary keys to identify the desired record.
  • A maximum of 200 records can be merged in one request.
  • All the Primary Key Fields of the table must be specified in the fieldnames attribute along with their corresponding values in the records attribute.
  • Field names specified in the fieldNames attribute are case sensitive. They must match their case as defined in the supplemental table.

Service URL:

/rest/api/v1.3/folders/{folderName}/suppData/{tableName}/members

Request Method:

POST

Request Header:

Authorization=<AUTH_TOKEN>

Content-Type=application/json

Sample Request Body:

    {
		"recordData" : {
		"fieldNames" : ["PK1", "PK2", "F1", "F2", "PK3"],
		"records" : [
		            ["1", "1", "onerec", "onecol", "1"],
		            ["1", "1", "tworec", "twocol", "2"],
		            ["1", "2", "threerec", "threecol", "2"],
		            ["1", "2", "fourrec", "fourcol", "3"],
		            ["1", "1", "fiverec", "fivecol", "1", ""]
		            ],
		"mapTemplateName" : null
	},
	 "insertOnNoMatch" : true,
	 "updateOnMatch" : "REPLACE_ALL"
}

Sample Response in case of success:

RESPONSE NOTES:

  • In case a record was merged successfully, the record in the response mirrors the record in the request payload.
  • In case merge failed, the first element of the record contains an error message starting with MERGEFAILED: and depending on the number of elements present in the record in the request, the other elements in the record in the response are empty strings. Client developers can look for the string MERGEFAILED: in the response for a particular row to determine whether that recipient was merged successfully or not.
  • The order of records in the response matches the order of records specified in the request payload.
  • Other attributes in the response, such as mapTemplateName, insertOnNoMatch, updateOnMatch, and matchColumn, will mirror the valid values specified in the request payload or default to null/false in case of invalid values.
{
   "recordData":    {
      "fieldNames":       [
         "PK1",
         "PK2",
         "F1",
         "F2",
         "PK3"
      ],
      "records":       [
         [
            "1",
            "1",
            "onerec",
            "onecol",
            "1"
         ],
       
[
            "1",
            "1",
            "tworec",
            "twocol",
            "2"
         ],
         [
            "1",
            "2",
            "threerec",
            "threecol",
            "2"
         ],
         [
            "1",
            "2",
            "fourrec",
            "fourcol",
            "3"
         ],
         [
            "MERGEFAILED: Record 4 = Field Names length, doesn't match with Field Values length\r\n",
            "",
            "",
            "",
            ""
         ]
      ],
      "mapTemplateName": null
   },
   "insertOnNoMatch": true,
   "updateOnMatch": "REPLACE_ALL",
   "links": [   {
      "rel": "self",
      "href": "/rest/api/v1.3/folders/DemoNewsLetter/suppData/CompositePKSuppTable/members",
      "method": "POST"
   }]
}

Sample Response in case not all primary key fields are specified in the request payload:

{
   "recordData":    {
      "fieldNames":       [
         "PK1",
         "PK2",
         "F1",
         "F2"
      ],
      "records":       [
                  [
            "MERGEFAILED: Record 0 = NOT UPDATED PER MERGE RULE. MATCH FIELD CANNOT BE EMPTY\r\n",
            "",
            "",
            ""
         ],
                  [
            "MERGEFAILED: Record 1 = NOT UPDATED PER MERGE RULE. MATCH FIELD CANNOT BE EMPTY\r\n",
            "",
            "",
            ""
         ],
                  [
            "MERGEFAILED: Record 2 = NOT UPDATED PER MERGE RULE. MATCH FIELD CANNOT BE EMPTY\r\n",
            "",
            "",
            ""
         ]
      ],
      "mapTemplateName": null
   },
   "insertOnNoMatch": true,
   "updateOnMatch": "REPLACE_ALL",
   "links": [   {
      "rel": "self",
      "href": "/rest/api/v1.3/folders/DemoNewsLetter/suppData/CompositePKSuppTable/members",
      "method": "POST"
   }]
}

Sample Response in case of failure:

{
   "type": "",
   "title": "Invalid request parameters",
   "errorCode": "INVALID_PARAMETER",
   "detail": "Invalid template mapping xuy",
   "errorDetails": []
}