I have been trying to make a simple getRecords request with C# code and I keep getting the error code 4844. I have refreshed my authorization token and checked accounts.zoho.com to verify the token is active. Any help would be greatly appreciated. The code used below is from the Zoho documentation.
using System;
using System.Net;
using System.IO;
using System.Web;
using System.Text;
using System.Net.Security;
public class ZohoCRMAPI
{
public static void Main (string[] args)
{
string result = APIMethod("Leads","getRecords","508020000000332001");//Change the id,method name, and module name here
Console.Write(result);
}
public static String APIMethod(string modulename,string methodname,string recordId)
{
string uri = zohocrmurl + modulename + "/"+methodname+"?";
/* Append your parameters here */
string postContent = "scope=crmapi";
postContent = postContent + "&authtoken=0ac32dc177c4918eca902fd290a92f4a";//Give your authtoken
if (methodname.Equals("insertRecords") || methodname.Equals("updateRecords"))
{
}
if (methodname.Equals("updateRecords") || methodname.Equals("deleteRecords") || methodname.Equals("getRecordById"))
{
postContent = postContent + "&id="+recordId;
}
string result = AccessCRM(uri, postContent);
return result;
}
public static string AccessCRM(string url, string postcontent)
{
WebRequest request = WebRequest.Create(url);
request.Method = "POST";
byte[] byteArray = Encoding.UTF8.GetBytes(postcontent);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
return responseFromServer;
}
}