REST API Library for SugarCRM

I’m working on this library for a couple of projects, and it may be useful if you want to talk to SugarCRM from your PHP application:

The library contains access to all of SugarCRM’s REST API functions (V4, so far) and attempts to wrap the Sugar data up into a number of models (Entry, EntryList and Module so far). The idea is that your application should not care about the REST link, or the strange internal structure of data provided and required by Sugar – all that should be hidden, so you can just deal with simple data as easily as possible.

The library is still going through a lot of refactoring, as I learn more about the SugarCRM API, more about some PHP design patterns I’ve not coded before, and finding more use-cases in current projects. If you want to use it, let me know, and I’ll try to keep you informed of any major changes. In the meantime, I’m assuming I’m the only person using it, so files will move, methods will change, but the intention is that it will always work. You have been warned 🙂

Any suggestions or contributions you can make, will also be much appreciated. There are methods in there that I will never be using, so will not get around to writing wrappers for them.

The “REST” API for SugarCRM is a bit of a misnomer. You can use any verb in your API requests, as long as it is POST. You can access resources on any path, as long as it is the main entry point. That is the way the API is. If it changes, this library should isolate your application from those changes (hopefully, improvements).

Take a look and let me know what is missing for your own use-case. Tell me if I am going totally the wrong way with this thing, or completely bypassing current best practice or modern PHP techniques. I want this to be something we can all use, and make it easy to integrate SugarCRM with any custom PHP application.

Edit: and yes, documentation is way behind on this thing, especially PHPdoc headers. For now, I’m just getting the library working and throwing comments in where I can, to explain how it works and why it works like it does.

5 Responses to REST API Library for SugarCRM

  1. sachin 2014-04-14 at 06:48 #

    Dear Jason Judge,

    I wanted to know more about your lib file.
    can you help me to undersatnd it.

    • Jason Judge 2014-04-22 at 12:41 #

      Where are you getting stuck? Have you managed to install it, preferably using composer?

  2. Roman NL 2014-04-27 at 06:17 #

    Hi Jason,

    Did you have a chance to test your library on SuiteCRM, now that SugarCRM is no more a FOSS project?

    Would it be difficult to switch to REST V4_1?

    • Jason Judge 2014-05-06 at 14:25 #

      No, I haven’t tested it yet, but it ought to work as SuiteCRM has not yet departed from the SugarCRM code-base. I’m not sure how long that will last, but I intend to keep them working together to support a number of live sites.

      I would love to see REST/V10 back-ported to SuiteCRM though. That would allow me to throw away a tonne of code in this API library that just works around the way the V4 API works (as a rough RPC API, and not really anything to do with REST). The docs for V10 run into nearly 150 pages when expanded, so it would not be trivial, but it it needs to be done.

  3. Sara 2015-04-29 at 01:46 #

    Can this be used with https. If so where is this changed.

Leave a Reply