forked from gddc/python_webservices_library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
65 lines (43 loc) · 1.45 KB
/
Copy pathtest.py
File metadata and controls
65 lines (43 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import sugarcrm
#x = sugarcrm.Sugarcrm("http://ruttanvm.cs.kent.edu:4080/service/v2/rest.php")
S = sugarcrm.Sugarcrm("http://ruttanvm.cs.kent.edu:4080/akubera/service/v2/rest.php", "admin", "admin")
if S.connected == 1:
print "Connection Successful!"
if S.id != 0:
print "Login Successful!"
m = S.get_module_fields('Accounts')
print m
"""
entry = S.set_entry('Accounts',[{'name':'name','value':'New Account'},{'name':'description', 'value':'NEW ACCOUNT FROM PYTHON!'}])
print entry['id']
exit()
"""
retail = S.get_entry_list('Accounts',"accounts.industry = 'retail'", "", "", ['id','name','sic_code'],[])
print "RETAIL:"
x = retail['entry_list'][0]
print x
print ""
for i in x['name_value_list']:
print i
print ""
modules = S.get_available_modules()
for m in modules["modules"]:
print m
exit()
s = S.get_user_id()
print "ID: "+s
#f = S.get_module_fields("Contacts")
#print f
#z = S.set_relationship('Accounts','blahblahblah','wdfjkslkdjf')
try:
t = S.get_entries_count("Contacts")
print "TEAM: "+str(t)
except sugarcrm.GeneralException:
pass
#data = {'session':x.id, 'module_name':'Accounts', 'query':"accounts.industry = 'Retail'", \
# 'order_by':'', 'offset':'','select_fields':['id','name','sic_code'],'link_name_to_fields_array':[]}
#args = {'method': 'get_entry_list', 'input_type': 'JSON', 'response_type' : 'JSON', 'rest_data' : data}
#args = urllib.urlencode(args)
#x.sendRequest(args)
#m = S.get_module_fields("Accounts")
#print m