In a previous post I showed you how to use Guzzle to interact with the new SugarCRM v10 API. Today, I would like to introduce you to an even easier way to utilize the new API, the SugarCRM REST API Wrapper Class.
Installation and Instantiation
Installation of this package is handled with Composer. Start by updating composer.json with the following information.
Next, install the package via Composer.
With the SugarCRM REST API Wrapper installed and auto loaded, we can now instantiate the class and authenticate against our SugarCRM instance.
Common Usage Examples
1. Searching for an account by Name.
2. Alternatively, we can retrieve an account by ID.
3. Retrieving a list of cases associated to an account.
4. Create a case and relate the case to an account.
5. Listing notes associated to a case.
6. Listing documents associated to the account. (Compare to using Guzzle without the wrapper class)
Summary
There you have it. Using this new wrapper class is very simple and involves much less code than using cURL or even Guzzle to interact with the new API. That said, the wrapper class requires Guzzle and will install it via composer for you.
Are there any other examples you would like to see? If so, please comment and I’ll update this post accordingly.