Wednesday, July 20, 2011

Building APIs with Apex REST Services

This post should probably have been titled, "How to get started building Apex REST Services for CloudSpokes challenges to help us rebuild our platform and put some money in your pocket ", but that was waaay too long. We want to enlist you again in our endeavors to rebuild the CloudSpokes site. Like most cool companies, we are using REST and JSON as well so that we can play nicely with virtually all platforms.

First of all, let me state that developing Apex REST services is not only fun but ridiculously easy. If you've used SOAP web services you'll love the new REST feature. I couldn't wait to see what our member could come up with. However, we launched a couple of challenges recently and were surprised that we received zero submissions. So I put on my thinking cap and spoke with a couple of developers who are agressive challenge submitters. Their comments were that the technology was too new, Developer orgs didn't have the feature enabled, there was no documentation and they didn't know how to get started.

Well, let my tell you my friend, I have solved all of your problems!

I've put a video together that shows you everything (yes, everything) you need to know to get started participating in our Apex REST challenges. The tutorial walks you through the entire process of building our Members service. It shows you how to structure your services (easy), how to use the new REST classes (easy), and how to use the Apigee Console for to test your services (super-duper easy).  The Apigee console even handles the OAuth for you!! Why write your own Java or Rails client app to test your classes? Just use the Apigee console! I've even published the entire code for the Members service at github so you can use it as a template. held an Apex REST webinar yesterday (it should be available here any day now) and release a bunch of documentation and code examples. They even made the announcement that all Developer org would automatically be enabled with the Apex REST feature. So now there's no excuse not to get started!

Here's the video mentioned above but it might be easier to view it at Youtube in full screen.

So here's how you can get started:

  1. Sign up for a new developer org at All new orgs are now enabled with the Apex REST services so you can get started right away without waiting for the feature to get enabled.
  2. Take a peek at the REST API site for tutorials, code snippets, webinars and documentation. You can even post questions to the message boards for quick answers to your problems.
  3. Watch this awesome video by our friends at Apigee entitled RESTful API Design: Teach a Dog to REST. We love the design principles.
  4. Watch the video above for a quick tutorial services and then check out the code.
  5. Install our package into your DE org to get started. It contains all objects, code and metadata you should need to begin developing for our challenges.
  6. Pick a challenge that you want to participate in.
  7. Use the Apigee Console for as your client application and beginning writing your entry!


  1. Nice article Jeff. I was trying to get started with REST and did't know where to start from, until I saw this article of yours.

    Couple of q:
    1. I believe you can have both JSON and XML, how can we do that?
    2. Any link on how to put that data in nice GUI?

  2. Seems that now REST API does not support parameters in get method

  3. Can you post an example of performing a record update using PATCH?

  4. Hi all.

    I created a post in Spanish that also explains it: