SplendidCRM REST API
SplendidCRM has had a SOAP API for many years. The original SOAP API was patterned after a similar SugarCRM API so that the SplendidCRM Plug-in for Outlook could work with both SplendidCRM and SugarCRM web applications.
We created the Full-Access API to support our original SplendidCRM Offline Client. The Full-Access API is a SOAP API that made it easy to synchronize the client to the server.
The REST API was created to support our HTML5 Offline Client and to support the various SplendidCRM browser extensions.
The SplendidCRM REST API is a layer on top of the modules.
The REST API consists of twenty methods. Three methods are informational, nine are for authentication and the remaining eight are for getting and updating data. Only eight methods are used to manage data because SplendidCRM is data driven.
The REST API relies upon the existing session management of the SplendidCRM web application. It is for this reason that it is critical that you verify that the session is authenticated before performing the module data operations.
SplendidCRM uses System.ServiceModel.Activation.WebScriptServiceHostFactory to provide REST services. The use of WebScriptServiceHostFactory has dramatically reduced the complexity of creating a REST service, but it has its drawbacks. The big problem, which you may encounter, is that this library cannot handle more than one binding. Also, in Web.config, you need to make sure that aspNetCompatibilityEnabled is true.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
If you get the following error, you need to remove the bindings in IIS.
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
Real-world examples of how to use the REST API can be found in the source code for the HTML5 Offline Client. The HTLM5 Offline Client is included in all editions of SplendidCRM.
Returns the version of the SplendidCRM web application.
public string Version
(
)
POST http://demo.splendidcrm.com/Rest.svc/Version
None.
Type: System.String
{"d":"6.1.4439.35048"}
The version, along with the edition, can be used to determine the features that are available. The string that is returned will match the SplendidCRM version number as displayed on the About page of the web application. The return value will look like 6.1.4439.35048.
Returns the edition of the SplendidCRM web application.
public string Edition
POST http://demo.splendidcrm.com/Rest.svc/Edition
{"d":"Community"}
The version, along with the edition, can be used to determine the features that are available. The string that is returned will match the SplendidCRM edition as displayed on the About page of the web application. The return value will be one of the following: Enterprise, Professional or Community.
Returns the server time adjusted to UTC.
public DateTime UtcTime
POST http://demo.splendidcrm.com/Rest.svc/UtcTime
Type: System.DateTime
{"d":"\/Date(1331613952737)\/"}
The date value can be converted to a JavaScript date by passing the integer value to the date object.
Returns the current authentication state.
public bool IsAuthenticated
POST http://demo.splendidcrm.com/Rest.svc/IsAuthenticated
Type: System.Boolean
{"d":true}
This method is typically called before any other operation that requires a valid and authenticated session. The Offline Client will use this information to determine if the user needs to be authenticated prior to performing a sync operation.
Returns the User ID for the current user.
public Guid GetUserID
POST http://demo.splendidcrm.com/Rest.svc/GetUserID
Type: System.Guid
{"d":"00000000-0000-0000-0003-000000000000"}
.
Returns the User Name for the current user.
public string GetUserName
POST http://demo.splendidcrm.com/Rest.svc/GetUserName
{"d":"will"}
Returns the Team ID for the current user.
public Guid GetTeamID
POST http://demo.splendidcrm.com/Rest.svc/GetTeamID
{"d":" 17bb7135-2b95-42dc-85de-842caff927a0"}
Returns the Team Name for the current user.
public string GetTeamName
POST http://demo.splendidcrm.com/Rest.svc/GetTeamName
{"d":"Global"}
Returns the Language for the current user.
public string GetUserLanguage
POST http://demo.splendidcrm.com/Rest.svc/GetUserLanguage
{"d":"en-US"}
The language is important because it is used to get the correct terminology data. The data includes lists.
Returns the profile for the current user.
public class UserProfile
{
public Guid USER_ID ;
public string USER_NAME ;
public Guid TEAM_ID ;
public string TEAM_NAME ;
public string USER_LANG ;
public string USER_DATE_FORMAT;
public string USER_TIME_FORMAT;
}
public UserProfile GetUserProfile
POST http://demo.splendidcrm.com/Rest.svc/GetUserProfile
{"d":
{"__type":"Rest.UserProfile:#SplendidCRM"
,"TEAM_ID":"17bb7135-2b95-42dc-85de-842caff927a0"
,"TEAM_NAME":"Global"
,"USER_DATE_FORMAT":"MM\/dd\/yyyy"
,"USER_ID":"00000000-0000-0000-0003-000000000000"
,"USER_LANG":"en-US"
,"USER_NAME":"will"
,"USER_TIME_FORMAT":"h:mm tt"
Performs user authentication and session initialization.
public Guid Login
( string UserName
, string Password
, string Version
POST http://demo.splendidcrm.com/Rest.svc/Login
UserName
Password
Type: System.String The password is in plain text, so it is advisable that a secure channel is used when connecting to the server.
Version
Type: System.String The Version is not used at this time, but is intended to be used to restrict functionality based on the version of the client.
This function is very similar to the web application login in the way that it authenticates a user and initializes the session. If successful, this function will return the User ID.
This method will throw an exception if the login fails.
{"ExceptionDetail":
{"HelpLink":null
,"InnerException":null
,"Message":"Invalid username and\/or password for will"
,"StackTrace":" at SplendidCRM.Rest.Login(String UserName, String Password, String Version) ..."
,"Type":"System.Exception"
,"ExceptionType":"System.Exception"
Performs a user logout.
public void Logout
POST http://demo.splendidcrm.com/Rest.svc/Logout
{"d":null}
Most lists come from the Terminology table. Those that do not are custom lists. Examples include Currencies, Releases, and Contract Types.
public Stream GetCustomList
( string ListName
GET http://localhost/SplendidCRM6/Rest.svc/GetCustomList?ListName=Currencies
ListName
Type: System.IO.Stream
{"results":
,"__count":"3"
Gets module table data. This method is generally used for system tables such as the CONFIG table.
public Stream GetModuleTable
( string TableName
GET http://demo.splendidcrm.com/Rest.svc/GetModuleTable?TableName=CONFIG&$select=NAME,VALUE&$orderby=NAME%20asc
TableName
,"__count":"1"
The SplendidCRM REST API uses an OData-like syntax that includes attributes such as $select and $orderby.
GetModuleList is the primary method of retrieving records for a specified module. The method accepts an OData-like syntax to allow the selection of fields, the ordering of the data and the filtering of the data.
public Stream GetModuleList
( string ModuleName
GET http://demo.splendidcrm.com/Rest.svc/GetModuleList?ModuleName=Contacts&$orderby=NAME%20asc&$select=NAME%2CID%2CASSIGNED_USER_ID%2CTITLE%2CACCOUNT_NAME%2CACCOUNT_ID%2CACCOUNT_ASSIGNED_USER_ID%2CEMAIL1%2CID%2CPHONE_WORK%2CASSIGNED_TO%2CTEAM_NAME%2CDATE_MODIFIED&$filter=%28%20%20FIRST_NAME%20like%20N%27%25Bob%25%27%20escape%20%27%5C%27%29
ModuleName
,"__count":"2"
GetModuleItem is the primary method for retrieving all data for a specified module and ID.
public Stream GetModuleItem
, Guid ID
GET http://demo.splendidcrm.com/Rest.svc/GetModuleItem?ModuleName=Contacts&ID=032d8ee7-ab2f-425b-ae38-ef54f8dcae38
{"__metadata":
{"uri":"http://demo.splendidcrm.com/Rest.svc/GetModuleItem?ModuleName=Contacts&ID=032d8ee7-ab2f-425b-ae38-ef54f8dcae38"
,"type":"SplendidCRM.Contacts"
,"etag":"032d8ee7-ab2f-425b-ae38-ef54f8dcae38.634609122677300000"
,"ID":"032d8ee7-ab2f-425b-ae38-ef54f8dcae38"
,"SALUTATION":"Mr."
,"NAME":"Bob Bobbins"
,"FIRST_NAME":"Bob"
,"LAST_NAME":"Bobbins"
,"LEAD_SOURCE":"Trade Show"
,"TITLE":"MD"
,"DEPARTMENT":null
,"REPORTS_TO_ID":null
,"REPORTS_TO_NAME":null
,"BIRTHDATE":"\\/Date(-62135596800000)\\/"
,"DO_NOT_CALL":false
,"PHONE_HOME":null
,"PHONE_MOBILE":null
,"PHONE_WORK":"01234 567890"
,"PHONE_OTHER":null
,"PHONE_FAX":null
,"EMAIL1":"bob@aol.com"
,"EMAIL2":null
,"ASSISTANT":null
,"ASSISTANT_PHONE":null
,"EMAIL_OPT_OUT":false
,"INVALID_EMAIL":false
,"PRIMARY_ADDRESS_STREET":"1 The Street"
,"PRIMARY_ADDRESS_CITY":"City"
,"PRIMARY_ADDRESS_STATE":"State"
,"PRIMARY_ADDRESS_POSTALCODE":"AB1 2CD"
,"PRIMARY_ADDRESS_COUNTRY":"UK"
,"ALT_ADDRESS_STREET":"1 The Street"
,"ALT_ADDRESS_CITY":"City"
,"ALT_ADDRESS_STATE":"State"
,"ALT_ADDRESS_POSTALCODE":"AB1 2CD"
,"ALT_ADDRESS_COUNTRY":"UK"
,"PORTAL_NAME":null
,"PORTAL_ACTIVE":false
,"PORTAL_APP":null
,"ASSIGNED_USER_ID":"00000000-0000-0000-0003-000000000000"
,"DATE_ENTERED":"\\/Date(1325297467640)\\/"
,"DATE_MODIFIED":"\\/Date(1325297467720)\\/"
,"DATE_MODIFIED_UTC":"\\/Date(1325315467730)\\/"
,"DESCRIPTION":"Hot lead!!"
,"ASSIGNED_TO":"will"
,"CREATED_BY":"will"
,"MODIFIED_BY":"will"
,"CREATED_BY_ID":"00000000-0000-0000-0003-000000000000"
,"MODIFIED_USER_ID":"00000000-0000-0000-0003-000000000000"
,"ACCOUNT_ID":null
,"ACCOUNT_NAME":null
,"ACCOUNT_ASSIGNED_USER_ID":null
,"TEAM_SET_ID":"e29b878a-640e-41f6-aad0-e6f62fc66e37"
,"TEAM_SET_NAME":"Global"
,"TEAM_SET_LIST":"17BB7135-2B95-42DC-85DE-842CAFF927A0"
,"ASSIGNED_TO_NAME":"Willy Wonka"
,"CREATED_BY_NAME":"Willy Wonka"
,"MODIFIED_BY_NAME":"Willy Wonka"
,"ID_C":"032d8ee7-ab2f-425b-ae38-ef54f8dcae38"
This method will throw an exception if the user does not have edit access to the specified module.
This method is used to update relationship tables.
public Guid UpdateModuleTable
( Stream input
POST http://demo.splendidcrm.com/Rest.svc/UpdateModuleTable
input
UpdateModule is the primary method used to create or update data within the CRM. It is used to update Accounts, Contacts, Leads, etc.
POST http://demo.splendidcrm.com/Rest.svc/UpdateModule?ModuleName=Contacts
,"DEPARTMENT":""
,"REPORTS_TO_ID":""
,"BIRTHDATE":null
,"PHONE_HOME":""
,"PHONE_MOBILE":""
,"PHONE_OTHER":""
,"PHONE_FAX":""
,"EMAIL2":""
,"ASSISTANT":""
,"ASSISTANT_PHONE":""
,"TEAM_ID":"17BB7135-2B95-42DC-85DE-842CAFF927A0"
,"ACCOUNT_ID":""
{"d":"032d8ee7-ab2f-425b-ae38-ef54f8dcae38"}
DeleteModuleItem is the primary method used to delete data within the CRM.
public void DeleteModuleItem
( String ModuleName
POST http://demo.splendidcrm.com/Rest.svc/DeleteModuleItem
{"ModuleName": "Contacts", "ID": "ecca024f-0081-40db-b6a9-1d95b1c36125"}
DeleteRelatedItem is used to remove relationships between two modules.
public void DeleteRelatedItem
, String RelatedModule
, Guid RelatedID
POST http://demo.splendidcrm.com/Rest.svc/DeleteRelatedItem
This method will throw an exception if the user does not have edit access to the specified modules.
The SplendidCRM Application Platform is constantly being improved. Please visit the SplendidCRM Software website to obtain the most recent version of the software:
http://www.splendidcrm.com
If you have any questions, please post them to the SplendidCRM Support forum:
http://www.splendidcrm.com/Forums/tabid/66/Default.aspx
If you discover any errors or omissions in this document, please email support@splendidcrm.com.