When there are 2 or more records in the destination table that contain the same external reference Id as the record being sent in the Patch operation, Salesforce returns a 300 response with a body containing a Json array containing all the duplicate matched records. So if record x and y have the same ext ref id and you try to Patch for x then you will receive the record info for y.
Of course when it tries to do so for this kind of content it blows up:
Newtonsoft.Json.JsonSerializationException: 'Error converting value "/services/data/v44.0/sobjects/Integration_DTO__c/a0w6C000000hqEmQAI" to type 'NetCoreForce.Client.Models.ErrorResponse'. Path '[0]', line 1, position 70.'
inner exception
ArgumentException: Could not cast or convert from System.String to NetCoreForce.Client.Models.ErrorResponse.
System.FormatException: 'Index (zero based) must be greater than or equal to zero and less than the size of the argument list.'
When there are 2 or more records in the destination table that contain the same external reference Id as the record being sent in the Patch operation, Salesforce returns a 300 response with a body containing a Json array containing all the duplicate matched records. So if record x and y have the same ext ref id and you try to Patch for x then you will receive the record info for y.
see documentation: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_upsert.htm
If the value is not unique, the REST API returns a 300 response with the list of matching records.
sample response:
JsonClient is trying to Deserialize the response for all non-success statuses as a List of ErrorResponses:
Of course when it tries to do so for this kind of content it blows up:
Newtonsoft.Json.JsonSerializationException: 'Error converting value "/services/data/v44.0/sobjects/Integration_DTO__c/a0w6C000000hqEmQAI" to type 'NetCoreForce.Client.Models.ErrorResponse'. Path '[0]', line 1, position 70.'
inner exception ArgumentException: Could not cast or convert from System.String to NetCoreForce.Client.Models.ErrorResponse.
System.FormatException: 'Index (zero based) must be greater than or equal to zero and less than the size of the argument list.'