Sugar Community Edition 5.2 Documentation

Sugar Developer Guide

Table of Contents Previous Next

Version 5.2



Note: If the Sugar config.php variables site_url is wrong, SugarSoap will not work. Be sure to verify this value before continuing.
Call: test
o
string:string – this is a string that you want to be echoed back to you
o
string:string – this is the string that was sent as an argument.
Call: login
o
complex-type:user_auth – contains the user credentials used to log in.
o
string:application_name – this is a unique application name(example: SugarCRM)
o
complex-type: set_entry_result - in this case the id of set_entry_result is the SugarSoap API’s session_id.
Note: This session id value is needed in all future SOAP calls. So you will want to store this in a session or application level variable.
user_auth is a struct containing three parameters:
o
string:user_name – this is the SugarSoap user name
o
string:password – this is an md5 of the SugarSoap user password
o
string:version – this is the version of SOAP you are expecting(at this point use 1.0)
set_entry_result is a struct containing two parameters.
o
string:id - this is the id for the result
o
complex-type:error (error_value) this is the error if any
error_value is a struct containing three parameters:
o
string:number - this is the error number. An error number of 0 indicates no errors were encountered
o
string:name – this is the error name
o
string:description – this is the error description
Call: get_user_id
o
string:session - this is the session_id retrieved during login that you should have stored in either the application or the session scope
o
string:return – this is the user_id for the current SugarSoap user who logged in
This will return a list of entries (results) for a list view of a module. Team-based security restrictions determine the resulting set of rows. It should also be noted that only the fields available in the module’s list view is available through the get_entry_list call. Note that restrictions to field access implemented via field-level ACLs (Professional and Enterprise Editions only) do not affect the fields returned.
Call: get_entry_list
o
string:session – this is the session_id
o
string:module_name – this is the module you wish to get results for (e.g. 'Calls')
o
string:query – this is the search query you wish to apply in retrieving the results (e.g. “(calls.name LIKE 'doctor appointment%' AND calls.date_start = CURDATE())” )
o
string:order_by – this is what you would like to order by for the results (e.g. the database column “calls.name”)
o
complex-type:select_fields – these are the fields you want returned. SugarSoap performance is better if you only retrieve the fields you need (e.g. name, description, date_start, time_start).
o
int:max_results – this is the maximum number of results you want returned if set to 0 it will return the default SugarSoap API’s amount for ListViews.
select_fields is an array of strings (these are the names of fields for a given module)
get_entry_list_result is an struct containing five parameters.
o
int:result_count – the number of results returned
o
int:next_offset – the next offset to use in a request
o
complex-type:field_list – this is meta data of the fields returned
o
complex-type:entry_list – this is the acctual result data
o
complex-type:error (error_value) any errors that occurred
field_list is an array of complex-type:field
o
field is a struct containing five parameters.
string:name – the db/sugar name for a field
string:type – the type of field (enum, text)
string:label – the translated label for the field
int:required – 1 for required 0 for not
complex-type:name_value_list – these are additional options such as for enumeration it would be the list of values for the enumeration.
o
name_value_list is an array of complex-type:name_value
name_value is a struct containing two parameters. This is a name value pair.
string:name – the name of the value (a.k.a key)
string:value – the value for the name
entry_list is an array of complex-type:entry_value
o
entry_value is a struct containing three parameters:
string:id – the sugar id for the entry
string:module_name – the module this entry is from
complex-type:name_value_list – the field values for this entry
So we retrieved a list of results for a module but you might need more details on a single record (entry) since get_entry_list is limited to what is available in the list view. You can get this information by retrieving a single entry using get_entry.
Call: get_entry
o
string:session – the session_id
o
string:module_name – the module for the entry you want to retrieve
o
string:id – the id of the entry you want to retrieve
o
complex-type:select_fields - the fields you want to retrieve
get_entry_result is a new complex type introduced in this section. It is a struct containing three parameters:
complex-type:field_list – this is metadata of the fields returned
complex-type:entry_list – this is the actual result data (in this case it will be an array of size 1)
complex-type:error (error_value) any errors that occurred
The reason for including entry_list in the same manner as get_entry_list_result is so that the same function can create data structures for both calls.
You may want to now modify or even create a new record (entry). This is where set_entry comes into place. Both modifying and creating a record are done from the same function call.
Call: set_entry
o
string:session – the session_id
o
string:module_name – the module for the entry you want to update/create
o
complex-type:name_value_list - the fields you want to set
Pass in the primary id of a record in the name_value_list complex field if you have a field called id otherwise to update a specific record. Otherwise if this field is empty, the system will create a new entry.
Call: get_module_fields
o
string:session – the session_id
o
string:module_name – the module that you want a list of fields for
o
complex-type: module_fields – these are the fields to use
module_fields is a new complex type introduced in this section. It is a struct containing three parameters:
string:module_name – the module name for the fields
complex-type:module_fields - (field_list) – these are the fields
complex-type:error (error_value) - any errors that occurred
Call: logout
o
string:session – the session_id
o
complex-type:error (error_value) – any errors (not logged in?)
Every Sugar installation comes with a series of SugarSoap examples located in the examples/ directory of the application installation. There you will find several examples that go beyond those outlined in this section.
Note: it is also possible to create a NuSOAP client as follows without requiring the WSDL:

Table of Contents Previous Next

Copyright 2004-2009 SugarCRM Inc.
Product License

User Contributed Comments

yadaom - 05-25-2010 05:31:56
Hi,
can any one tell me that how to use nusoapclient using. Using java i am not able to add lead details like phone, lead source etc...
Add a Comment
E-mail:
Comment:
Have feedback for us? Drop us a line.
Terms & Conditions | Privacy | Trademark Info | Contact Info | FAQs | SugarCRM Inc.© 2004 - 2009 All rights reserved.