Merge supplemental table records without 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 using a matchColumnNames attribute in the payload.
  • A maximum of 200 records can be merged in one request.
  • Use the matchColumnNames attribute in the payload to identify the column to use to match to a record in the supplemental table without a primary key.
  • This interface enforces that insertOnNoMatch is true and updateOnNoMatch is “REPLACE_ALL” in the request payload.
  • 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" : ["F1", "F2"],
		"records" : [
		            ["onerec", "updatedvalues"]
		            ],
		"mapTemplateName" : null
	},
	 "insertOnNoMatch" : true,
	 "updateOnMatch" : "REPLACE_ALL",
	 "matchColumnNames" : ["F1"]
}

Sample Response in case of success:

RESPONSE NOTES:

  • IWhen a record was merged successfully, the record in the response mirrors the record in the request payload.
  • In case merge failed for a record for some reason, 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. Furthermore, other attributes in the response (mapTemplateName, insertOnNoMatch, updateOnMatch, and matchColumnNames) will mirror the valid values specified in the request payload or default to null/false in case of invalid values.
{
   "recordData":    {
      "fieldNames":       [
         "F1",
         "F2"
      ],
      "records": [[
         "onerec",
         "updatedvalues"
      ]],
      "mapTemplateName": null
   },
   "insertOnNoMatch": true,
   "updateOnMatch": "REPLACE_ALL",
   "matchColumnNames": ["F1"],
   "links": [   {
      "rel": "self",
      "href": "/rest/api/v1.3/folders/DemoNewsLetter/suppData/CompositePKSuppTable/members",
      "method": "POST"
   }]
}

Sample Response in case matchColumnNames and fieldNames specified cannot be used to identify records to merge:

Sample Payload:

{
	"recordData" : {
		"fieldNames" : ["PK1", "PK2", "F1", "F2", "PK3"],
		"records" : [
		            ["1", "1", "onerec", "onecol", "1"],
		            ["1", "1", "onerec", "onecol", "2"],
		            ["1", "1", "onerec", "onecol", "3"]
		            ],
		"mapTemplateName" : null
	},
	 "insertOnNoMatch" : true,
	 "updateOnMatch" : "REPLACE_ALL",
	 "matchColumnNames" : ["F1"]
}

Response:

  {
   "recordData":    {
      "fieldNames":       [
         "PK1",
         "PK2",
         "F1",
         "F2",
         "PK3"
      ],
      "records":       [
                  [
            "MERGEFAILED: Unable to identify record to Merge from the Match Columns and FieldNames Specified.",
            "",
            "",
            "",
            ""
         ],
                  [
            "MERGEFAILED: Unable to identify record to Merge from the Match Columns and FieldNames Specified.",
            "",
            "",
            "",
            ""
         ],
                  [
            "MERGEFAILED: Unable to identify record to Merge from the Match Columns and FieldNames Specified.",
            "",
            "",
            "",
            ""
         ]
      ],
      "mapTemplateName": null
   },
   "insertOnNoMatch": true,
   "updateOnMatch": "REPLACE_ALL",
   "matchColumnNames": ["F1"],
   "links": [   {
      "rel": "self",
      "href": "/rest/api/v1.3/folders/DemoNewsLetter/suppData/CompositePKSuppTable/members",
      "method": "POST"
   }]
}

Sample Response in case insertOnMatch or updateOnNoMatch are invalid:

Sample Payload:

{
	"recordData" : {
		"fieldNames" : ["F1", "F2"],
		"records" : [
		            ["onerec", "updatedvalues"]
		            ],
		"mapTemplateName" : null
	},
	 "insertOnNoMatch" : false,
	 "updateOnMatch" : "REPLACE_ALL",
	 "matchColumnNames" : ["F1"]
}

Response:

{
  "type": "",
  "title": "Invalid request parameters",
  "errorCode": "INVALID_PARAMETER",
  "detail": "insertOnNoMatch must be true and updateOnMatch must be REPLACE_ALL if matchColumnNames is specified",
  "errorDetails": []
}

Sample Response in case matchColumnNames attribute is not specified:

Sample Payload:

{
	"recordData" : {
		"fieldNames" : ["F1", "F2"],
		"records" : [
		            ["onerec", "updatedvalues"]
		            ],
		"mapTemplateName" : null
	},
	 "insertOnNoMatch" : false,
	 "updateOnMatch" : "REPLACE_ALL",
	 "matchColumnNames" : null
}

Response:

{
  "type": "",
  "title": "Invalid request parameters",
  "errorCode": "INVALID_PARAMETER",
  "detail": "MatchColumnNames must be specified to merge into a table that does not have any primary keys",
  "errorDetails": []
}