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

Sample Create Contact to an existing Account using SDATA and CURL

Here a sample creating a Contact to an existing Account 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/-/Contacts('') --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><Contact xmlns='http://schemas.sage.com/dynamic/2007'><FirstName>Rainer</FirstName><LastName>Raebiger</LastName><Account sdata:key='ACCOUNTID' /></Contact></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/-/Contacts('')

--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>

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

        <FirstName>Rainer</FirstName>

        <LastName>Raebiger</LastName>

        <Account sdata:key='ACCOUNTID' />

      </Contact>

    </sdataSmiley Tongueayload>

  </entry>

"

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

 

 

Thanks to BootCamp Team 2011. Sample of C# (Adding Ticket) and Fiddler was a great help to get this solved.

Regards
Rainer Raebiger
Silver Contributor
Posts: 835
Registered: ‎03-24-2009

Re: Sample Create Contact to an existing Account using SDATA and CURL

What is CURL?

 

RJ Samp
Highlighted
Bronze Super Contributor
Posts: 113
Registered: ‎07-27-2009

Re: Sample Create Contact to an existing Account using SDATA and CURL

[ Edited ]

Hi RJ,

 

curl can be used under PHP to talk to Webserver, in this case to SDATA. Have a look also at:

 

http://community.sagesaleslogix.com/t5/Developer-Web-Discussions/sdata-API-and-PHP-XML-cURL/m-p/1336...

 

Background in our case:

 

Two Servers: Webserver (CMS) in DMZ and SDATA-Server in the local network

Customer shall have the possibility to change and create data over an a website (on Webserver). Website will send data via PHP/CURL to the SDATA-Server.

 

To find out how the string has to look like, i used curl for Windows. Our Webdeveloper will use curl under PHP.

Regards
Rainer Raebiger