Skip to content
jdang edited this page Apr 27, 2011 · 11 revisions

###SetEntry example:

To demonstration of how to create a new module to the server, first we call sugarcrm that will connect us to the server with the url, username, password:

S = sugarcrm.Sugarcrm("http://ruttanvm.cs.kent.edu:4080/<username>/service/v2/rest.php", <"username">, <"password">)

After that, just to confirm that we are successfully connected to the server. Then we can call set_entry function.

i = S.set_entry('Contacts', [{'name':'first_name', 'value': 'first_name'}, {'name':'last_name', 'value':'last_name'},{'name':'title', 'value':'CEO'}])

Example code:

S = sugarcrm.Sugarcrm("http://ruttanvm.cs.kent.edu:4080/<username>/service/v2/rest.php", <"username">, <"password">)

if S.connected == 1:
    print "Connection Successful!"
if S.id != 0:
    print "Login Successful!"

i = S.set_entry('Contacts', [{'name':'first_name', 'value': 'first_name'}, {'name':'last_name', 'value':'last_name'},{'name':'title', 'value':'CEO'}])
print i

Clone this wiki locally