I've been tasked with using zoho support for our ticketing system. As I try to add zoho into our existing web form I have come across an issue. I really want to use zoho since we plan to use the CRM as well, but I can't get this simple task to work.
Typically when submitting xml data I'd use something like this:
- Dim req As System.Net.WebRequest = Nothing
- Dim rsp As System.Net.WebResponse = Nothing
- Dim Request As String = ""
- Request = Request & "authtoken=MyAuthToken&portal=PortalName&department=Support&xml="
- Request = Request & "<requests>"
- Request = Request & "<row no=""1"">"
- Request = Request & "<fl val=""Subject"">Support Request</fl>"
- Request = Request & "<fl val=""Contact Name"">" & tbFirstName.Text & " " & tbLastName.Text & "</fl>"
- Request = Request & "<fl val=""Product Name"">" & tbCompanyName.Text & "</fl>"
- Request = Request & "<fl val=""Email"">" & tbEmail.Text & "</fl>"
- Request = Request & "<fl val=""Phone"">" & tbPhone.Text & "</fl>"
- Request = Request & "<fl val=""Description"">" & tbDescription.Text & "</fl>"
- Request = Request & "</row>"
- Request = Request & "</requests>"
- Try
- Dim url As String = "https://support.zoho.com/api/xml/requests/addrecords?"
- req = System.Net.WebRequest.Create(url)
- req.Method = "POST"
- req.ContentType = "text/xml"
- Dim writer As New System.IO.StreamWriter(req.GetRequestStream())
- writer.WriteLine(Request)
- writer.Close()
- rsp = req.GetResponse()
- Catch
- Throw
- Finally
- If req IsNot Nothing Then
- req.GetRequestStream().Close()
- End If
- If rsp IsNot Nothing Then
- rsp.GetResponseStream().Close()
- End If
- End Try
I always get a 400 Bad Request error. When I manually type in the url along with the xml data I can create tickets just fine. Is there some way to add a record from code behind in .net? I need a good example please!