Consistent 4600 error with Python API implementation
I'm trying to insert a new lead via the API and I keep getting a 4600 error. I think it has something to do with the xmlData string. Would really appreciate some help with this.
This is the endpoint I am using:
Attached is an image of the query string that's getting appended to the endpoint.
And this is the function I am executing (the string formatting is working properly):
-
- import urllib
- import urllib2
-
- def send_to_zoho(inquiry):
-
- authtoken = 'AUTHTOKENGOINGHERE'
- scope = 'crmapi'
-
- xmlData = "<Leads>"
- xmlData += "<row no='1'>"
- xmlData += "<FL val='First Name'>Dylan</FL>"
- xmlData += "<FL val='Last Name'>Faux</FL>"
- # xmlData += "<FL val='Zip Code'>{0}</FL>".format(inquiry.zipcode)
- # xmlData += "<FL val='Street'>{0}</FL>".format(inquiry.street_address)
- # xmlData += "<FL val='City'>{0}</FL>".format(inquiry.city)
- # xmlData += "<FL val='Phone'>{0}</FL>".format(inquiry.phone_number)
- # xmlData += "<FL val='Email'>{0}</FL>".format(inquiry.email)
- xmlData += "</row>"
- xmlData += "</Leads>"
-
- params = {
- 'newFormat': '1',
- 'authtoken':authtoken,
- 'scope':scope,
- 'xmlData':xmlData,
- }
-
- endpoint = "https://crm.zoho.com/crm/private/xml/Leads/insertRecords"
-
- data = urllib.urlencode(params)
- print data
-
- request = urllib2.Request(endpoint,data)
- response = urllib2.urlopen(request)
- xml_response = response.read()
- print xml_response