Create a Contact With Winform C#


I am creating a contact using C# winforms, while i submit a request it’s giving a error of Unauthorized (401),


Hi @Muhammad_Usman_Shaik,

Can you give me some more details on the request you’re making? It’d be helpful to get to see the request you’re making; are you submitting to the forms API?


Hi Derek,

I thought I would add what I found after investigating this problem as this thread is the top result for winforms and creating a contact and has no resolution (which is frustrating :slight_smile: ).

I was trying to create a contact from the “Contacts API” using the “contacts/v1/contact” request from a .net Winform using the RestSharp library and was getting the same 401 error on the demo portal.

The error pointed to the correct issue in that it couldn’t authorize the request as the hapikey parameter was not making it’s way into the request URL. I was using the AddParameter method of the RestRequest object. This works fine for GET requests but for POST requests you have to use the AddQueryParameter parameter instead.

I hope this helps someone else if they come across the same problem.