Bad Request when posting a deal


I’m trying to write a simple, one time import for hubspot. At the moment, just trying to update a single property, but it’s failing. Getting “Bad Request”, but I can’t figure out why. Code is as follows, with JSON below. Any ideas?

Private Sub UpdateDeal(dealId As Long, opportunity As ExcelOpportunity)
    Dim url As String = "" & dealId & "?hapikey=" & hapikey & "&portalId=" & portalid
    Dim req As WebRequest = WebRequest.Create(url)
    req.Method = "PUT"
    req.ContentType = "application/json"

    Dim update As New DealUpdate
    update.AddProperty("user_type", opportunity.User_type__c)
    Dim json As String = JsonConvert.SerializeObject(update)
    Dim jsonBytes As Byte()
    jsonBytes = System.Text.Encoding.Unicode.GetBytes(json)
    req.ContentLength = jsonBytes.Length

    Dim stream = req.GetRequestStream
    stream.Write(jsonBytes, 0, jsonBytes.Length)

    Dim response = req.GetResponse.GetResponseStream
    Dim reader As New StreamReader(response)
    Dim res = reader.ReadToEnd

End Sub



Hi @James_Meyer

Are you able to log the body of that error response? There should be more details in the message in that response body.