I'm having trouble adding leads to Zoho CRM from Ruby. When I run the code below, I get an error 4834 "Invalid Ticket Id" from the API, even though I'm not using a ticket (I'm using the authentication token). I have verified that my authentication token works by using it successfully with the getCVRecords call.
Any help is appreciated.
xml_lead =<<END
<Leads>
<row no="1">
<FL val="Lead Owner">#{lead_owner}</FL>
<FL val="Company">#{company}</FL>
<FL val="First Name">#{first_name}</FL>
<FL val="Last Name">#{last_name}</FL>
<FL val="Designation"></FL>
<FL val="Email">#{email}</FL>
<FL val="Phone">#{phone}</FL>
<FL val="Fax"></FL>
<FL val="Mobile"></FL>
<FL val="Website"></FL>
<FL val="Lead Source">Web Form</FL>
<FL val="Lead Status">Opportunity</FL>
<FL val="Industry"></FL>
<FL val="No of Employees"></FL>
<FL val="Annual Revenue"></FL>
<FL val="Salutation"></FL>
<FL val="Street"></FL>
<FL val="City"></FL>
<FL val="State"></FL>
<FL val="Zip Code"></FL>
<FL val="Country">USA</FL>
<FL val="Description">Incoming lead from website.</FL>
<FL val="Number of Members"></FL>
</row>
</Leads>
END
http = Net::HTTP.new('crm.zoho.com', 443)
http.use_ssl = true
path = "/crm/private/xml/Leads/insertRecords"
data = "newFormat=1&authToken=#{@@AUTHTOKEN}&scope=crmapi&xmlData=#{xml_lead}"
headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
resp, rdata = http.post(path, data, headers)