Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
Bronze Super Contributor
Posts: 113
Registered: ‎07-27-2009

Sample Create Lead and Address using SDATA and CURL

[ Edited ]

Here a sample creating a Lead with Adress using SDATA and CURL (in this case CURL for Windows)


Download CURL from here.

Create a Textfile and insert text OR Download attached file
Save file as .cmd or .bat in the same directory as curl
Replace SERVER
Replace PORT
Replace USERNAME (e. g. admin)
Replace PASSWORD
Replace ACCOUNTID

Attention:
-- Within the file, whole text needs to be in 1 line!!!
-- Emoticons are colon and P

curl --url http://SERVERSmiley TongueORT/sdata/slx/dynamic/-/Leads('') --user USERNAMESmiley TongueASSWORD --data "<?xml version='1.0' encoding='utf-8'?><entry xmlns:sdata='http://schemas.sage.com/sdata/2008/1' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://www.w3.org/2005/Atom'><sdataSmiley Tongueayload><Lead xmlns='http://schemas.sage.com/dynamic/2007'><Prefix>PREFIX</Prefix><FirstName>FIRSTNAME</FirstName><LastName>LASTNAME</LastName><Company>COMPANY</Company><Address><Address1>ADDRESS1</Address1><City>CITY</City><Postalcode>POSTALCODE</Postalcode><Country>COUNTRY</Country></Address></Lead></sdataSmiley Tongueayload></entry>" --header "Content-Type: application/atom+xml; type=entry"

rem remove rem in the next line for seeing the result
rem pause


For better reading, same code again

curl

--url http://SERVERSmiley TongueORT/sdata/slx/dynamic/-/Leads('') --user USERNAMESmiley TongueASSWORD

--data

"

<?xml version='1.0' encoding='utf-8'?>

  <entry xmlns:sdata='http://schemas.sage.com/sdata/2008/1' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://www.w3.org/2005/Atom'>

    <sdataSmiley Tongueayload>

      <Lead xmlns='http://schemas.sage.com/dynamic/2007'>

        <Prefix>PREFIX</Prefix>

        <FirstName>FIRSTNAME</FirstName>

        <LastName>LASTNAME</LastName>

        <Company>COMPANY</Company>

        <Address>

          <Address1>ADDRESS1</Address1>

          <City>CITY</City>

          <Postalcode>POSTALCODE</Postalcode>

          <Country>COUNTRY</Country>

        </Address>

      </Lead>

    </sdataSmiley Tongueayload>

  </entry>

"

--header "Content-Type: application/atom+xml; type=entry"

Regards
Rainer Raebiger