How to Send XML API String to crm

How to Send XML API String to crm

I am trying to convert a lead in zoho crm to a potential from Creator.

I have followed the documentation here as best I can:
https://www.zoho.com/crm/help/api/convertlead.html


I have created the XML String but im not sure I know how to properly post this.

I am using POST URL function and hopefully I have it formatted correct. I took all my values and put them into a map variable including my XML string.

The process of stringing together values to make the XML string is pretty stupid. Maybe there is a better way to do this?

Here is the code i have put together but i am getting an error and im not sure how to diagnose this error.

Error " 4500 Internal server error while processing this request"

  1. xml_string="<Potentials><row no='1'><option val='createPotential'>true</option><option val='assignTo'>info@precisionsailloft.com</option><option val='notifyLeadOwner'>false</option><option val='notifyNewEntityOwner'>false</option></row>";
  2. xml_Name="<row no='2'><FL val='Potential Name'>" + lfirst + " " + llast + "</FL>";
  3. xml_Closing="<FL val='Closing Date'>" + zoho.currentdate + "</FL>";
  4. xml_Stage="<FL val='Potential Stage'>Closed Won</FL>";
  5. xml_Role="<FL val='Contact Role'></FL>";
  6. xml_Amount="<FL val='Amount'>" + net + "</FL>";
  7. xml_Probability="<FL val='Probability'>100</FL></row></Potentials>";
  8. lead_num=Client_Info.Lead_ID.toString();
  9. POTENTIALXMLDATA=xml_string + xml_Name + xml_Closing + xml_Stage + xml_Role + xml_Amount + xml_Probability;
  10. topotential = map();
  11. topotential.put("authtoken", "apitokenhidden");
  12. topotential.put("scope", "crmapi");
  13. topotential.put("leadId", Client_Info.Lead_ID.tostring());
  14. topotential.put("newFormat", 1);
  15. topotential.put("version", 2);
  16. topotential.put("xmlData",POTENTIALXMLDATA);

  17. convertlead2 = postUrl("https://crm.zoho.com/crm/private/xml/Leads/convertLead",topotential, false);