While using Salesforce Api to push data from C# to Salesforce objects, I got stuck for Contacts object not pushing data as it was already available in Contacts object. So there are two possibilities to cope with this.
On Salesforce you get a popup to create new or use existing one, but how you can know about duplication using Api.
After exploring more on Salesforce Api documentation, I found the following link to implement allow duplicates via Api. https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_duplicaterules.htm
Now the question is how can I Include this header in HttpClient request?
The answer to this question, I tried
client.DefaultRequestHeaders.Add("Sforce-Duplicate-Rule-Header", "allowSave=true;includeRecordDetails=false;");
It did not work, but the following line worked.
client.DefaultRequestHeaders.Add("Sforce-Duplicate-Rule-Header", "allowSave=true");
It saved the duplicate Contacts Object record in Salesforce.