Hi I am using an api called HubSpot to update lead data on the HubSpot portal.
Here is the link to the Contact Update call -
Here is the way you are supposed to POST -
and you pass JSON data like this -
I know the code works because if the JSON data is correctly formed everything updates fine and there are no errors
If the JSON data is not formed correctly I get an error 400 -
System.Net.WebException: The remote server returned an error: (400) Bad Request.
When this line is hit -
response = (HttpWebResponse)request.G
the C# code immediately hits the "catch" block and my response variable is null -
However, if I If I process the same POST (with improperly formed JSON) using POSTMAN (a Google Chrome plugin), I get more information.
I still get the error 400 Bad Request, but I actually see return JSON which gives more detail about the error.
roperty \\\"Lifecyclestage\\\" does not exist\",\"error\":\"PROPER
My question is how do I get this returned JSON data in my C# code since the response variable never gets set because it errors out.