REST API, ProgrammableWeb and cURL

A little more on the REST API - how's your cURL?

I’ve just seen a great ProgrammableWeb post about our forthcoming REST API and webinar.

Jeremy Glassenberg makes an excellent point about the ease of development in REST, and how that’s resulted in immense growth of REST APIs.

We, as developers, should be thinking about the same thing.  What happens when you have a REST API for the application you’ve built on Force.com?  What new opportunities does that create?  For one thing, other people will be able to more easily access *your* data and functionality – they’ll be able to more easily mash up your app with some other app (ProgrammableWeb has a great directory of APIs).

And yes, it’s really easy to use.  Once you have an authorisation token (you can use OAuth 2.0 to generate one), using the REST API (Quinton gave a sneak peek in a post a while back) is a doddle.  You can even use the venerable cURL command line tool.

For example, you could retrieve the name field from your FooBar object using something like this:

curl http://na1.salesforce.com/services/data/v2x.x/query?q=SELECT+name+from+FooBar -H "Authorization: OAuth token" -H "X-PrettyPrint:1"

What you’d get streaming out on your console window is some nice JSON.  Perhaps something like this:

{
"done" : true, "totalSize" : 33, "records" :
[
{  "attributes" : {
"type" : "FooBar", "url" : "/services/data/v2x.x/sobjects/FooBar/001E000000IRFmaIAH"}, {
},
"Name" : "Test 1"
}  ,
{  "attributes" : {
"type" : "FooBar", "url" : "/services/data/v2x.x/sobjects/FooBar/001E000000IomazIAB"
},
"Name" : "Test 2"
},
....
]
}

You’d also have access to the metadata using the REST API – data about the shape of your data.  All from the command line, if you really want it – or any tool or language that handles basic HTTP.

REST API is not GA yet – it’s a pilot feature – but we’ll soon be running a developer preview. Signup to learn more – and in the mean time think about what this means to your apps as well!

Published
October 6, 2010
Topics:

Leave your comments...

REST API, ProgrammableWeb and cURL