Interacting with the new RESTful Sugar Web Services… in PHP

bsoremsugar —  June 24, 2013 — 16 Comments

Sugar 7 is not too far away, but available right now for those of you working with a Sugar On Demand instance is our new RESTful API. This API is a dramatic shift from our previous API, the previous being more RPC style ( meaning designed around method calls ) to a more RESTful style ( meaning being designed around HTTP verbs and access to objects ). This is more inline with what developers tend to expect, but also enables an easier model for interacting with these services.

Over the next few days, I’m going to be going thru some examples of interacting with the new API using various languages. We also are looking to build out various API toolkits for these languages over time, and would definitely like the input of our community to help drive which ones you’d like to see built. Let us know in the comments or on Twitter which ones to focus on.

But without further ado, let’s jump into our first example, in PHP.

There are two pieces to this script. First, is authentication, which now returns back an oAuth token versus a session id. Then in the second call, we pass that oAuth token in the header back to the server for authentication.a

With this API powering much of Sugar going forward, it can handle just about anything that is done in the UI. For a full list of functionality, you can hit up the  /rest/v10/help endpoint on your instance with the full list of available endpoints.

Come back tomorrow for another language!

16 responses to Interacting with the new RESTful Sugar Web Services… in PHP

  1. 

    Here is a link for using the GuzzlePHP library for abstracting the curl setup https://gist.github.com/dlively1/5858513

  2. 

    Hey John,
    just for sanity check: do you know if SugarCRM 7.X is backward compatible with the 6.x api? (eg: /service/v4/rest.php)

    Thanks!

    • 

      Versions prior to v10 will be eventually phased out, i think. I;m not sure if v4 even included in SugarCRM 7. I also think it is safe to asume that SugarCRM 7 will have nearly identical API to 6.7.

      • 

        Like @mkozlov:disqus said, we will eventually phase out earlier versions of our API. However, this will not happen in Sugar 7; all web services APIs from the past will still be there.

  3. 

    Hi John,
    As a partner I can access the source tree of SugarCRM 7? For my work I could use to study integration in preview the new REST API and write a few new article.

    Thank you very much,

    Antonio.

Trackbacks and Pingbacks:

  1. SugarCRM Developer Blog » Blog Archive » Interacting with the new RESTful Sugar Web Services… in Python - June 25, 2013

    […] SugarCRM Developer Blog « Interacting with the new RESTful Sugar Web Services… in PHP […]

  2. SugarCRM Developer Blog » Blog Archive » Interacting with the new RESTful Sugar Web Services… in Java - June 26, 2013

    […] looked at both PHP and Java this week so far, now let’s look at Java. Since Java doesn’t have the same […]

  3. SugarCRM Developer Blog » Blog Archive » Interacting with the new RESTful Sugar Web Services… in Node.js - June 27, 2013

    […] touched on PHP, Java, and Python in this week’s series, and now we’ll look at using Node.js. To make […]

  4. SugarCRM Developer Blog » Blog Archive » Replacing sudo_user in the old SOAP API in the new Sugar 7 REST API - July 16, 2013

    […] that never made it to the newer APIs. As we are looking to drive more users towards the RESTful API in Sugar 6.7 and later, we’ve listened to you and have brought back ways to do those same things with the newest […]

  5. SugarCRM Developer Blog » Blog Archive » Doing PUT and DELETE with CURL in PHP - August 30, 2013

    […] the new Web Services API relies more heavily on using HTTP verbs to work with records, the question came up on how to do this […]

  6. SugarCRM Developer Blog » Blog Archive » Exporting a report as a PDF via Web Services - September 16, 2013

    […] based on the v4_1 API, on how to do this. Come back tomorrow to see how to do this with the new Web Services API in Sugar 6.7 and […]

  7. SugarCRM Developer Blog » Blog Archive » Check out the updated developer guide for Sugar 7! - September 27, 2013

    […] Examples of how to use the new REST API […]

  8. SugarCRM Developer Blog » Blog Archive » Starfish ETL first to support SugarCRM’s new REST interface! - October 9, 2013

    […] today from Aron Hoekstra that their Starfish ETL tool has successfully transitioned to using the new REST API in Sugar 7, which has given them a huge speed and usability improvement. From the announcement… Get a […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s