Let the platform do the work

Legacy API

Overview

v1 - v4.1 API documentation.

SOAP VS REST

There are significant differences between how the legacy REST and SOAP protocols function on an implementation level (e.g. Performance, response size, etc). Deciding which protocol to use is up to the individual developer and is beyond the scope of this guide. Starting in SugarCRM version 6.2.0, there are some deviations between the protocols with the v4 API. There are additional core calls that are only made available through the REST protocol. They are listed below:

  • get_module_layout
  • get_module_layout_md5
  • get_quotes_pdf method
  • get_report_pdf method
  • snip_import_emails
  • snip_update_contacts
  • job_queue_cycle
  • job_queue_next
  • job_queue_run
  • oauth_access method
  • oauth_access_token
  • oauth_request_token

REST

REST stands for 'Representational State Transfer'. This protocol is used by Sugar to exchange information both internally and externally.

How do I access the REST service?

The legacy REST services in SugarCRM and be found by navigating to:

http://{site url)/service/{version}/rest.php

Where 'site url' is the URL of your Sugar instance and 'version' is the latest version of the API specific to your release of Sugar. You can find out more about versioning in the Web Services documentation.

Input / Output Datatypes

The default input / output datatype for REST is JSON / PHP serialize.

These datatype files, SugarRestJSON.php and SugarRestSerialize.php, are in:

./service/core/REST/

Defining your own Datatypes

You can also define you own datatype. To do this, you need to create a new file such as:

./service/core/REST/SugarRest<CustomDataType>.php

Next, you will need to override generateResponse() and serve() functions. The Serve function decodes or unserializes the appropriate datatype based on the input type; the generateResponse function encodes or serializes it based on the output type.

See service/test.html for more examples on usage. In this file, the getRequestData function, which generates URL with json, is both the input_type and the response_type. That is, the request data from the JavaScript to the server is JSON and response data from server is also JSON. You can mix and match any datatype as input and output. For example, you can have JSON as the input_type and serialize as the response_type based on your application's requirements.

REST Failure Response

If a call failure should occur, the result will be as shown below:

Name Type Description
name String Error message.
number Integer Error number.
description String Description of error.

SOAP

SOAP stands for 'Simple Object Access Protocol'. SOAP is a simple XML-based protocol that is used to allow applications to exchange information.

How do I access the SOAP service?

The legacy SOAP service in SugarCRM and be found by navigating to:

  http://{sugar_url)/service/{version}/soap.php

Where 'sugar_url' is the url of your Sugar instance and 'version' is the latest version of the API specific to your release of Sugar. You can find out more about versioning in the section titled 'API: Versioning'. The default WSDL is formatted as rpc/encoded.

WS-I 1.0 Compliancy

Sugar supports generating a URL that is WS-I compliant. When accessing the soap entry point, you can access the WSDL at:

  http://{sugar_url)/service/{version}/soap.php?wsdl

By default, the WSDL is formatted as rpc/encoded, however, this can be changed by specifying a 'style' and 'use' url-paramater. An example of this is:

  http://{sugar_url)/service/{version}/soap.php?wsdl&style=rpc&use=literal

URL Parameters

style
  • rpc
use
  • encoded
  • literal

Validation

This WSDL (rpc/literal) was successfully verified against Apache CXF 2.2.

SOAP Failure Response

If a call failure should occur, the result will be as shown below:

Name Type Description
faultcode Integer Fault ID.
faultactor String Provides information about what caused the fault to happen.
faultstring String Fault Message.
detail String Description of fault.

Topics