Reputation: 19831
Are there any good write-ups on creating RESTful APIs with Drupal? I see the services API, which I guess is how it's done. What I'm looking for, I suppose is a comparison of drupal vs. other frameworks for that particular purpose.
Update - a bit more info:
In particular, I'm probably going to want to be returning json, and ideally using http request verbs (PUT, POST, GET, DELETE) properly with the common resource urls. I.e. http://mysite/api/widgets/1 (POST -> create, GET -> view, PUT -> update, DELETE -> delete) as opposed to http://mysite/api/widgets/1/delete
Upvotes: 11
Views: 8159
Reputation: 4873
I cannot compare with other frameworks, but Service 3.x (that's version 3 of the Services module) provides a resource driven model for service with a REST backend (and an XML-RPC one). According to its documentation, you can create a new resource type quite easily (if you are familiar with Drupal) using a simple API as it takes care of JSON[P]/XML parsing and serialization.
Updated, prompted by David Eads' answer: I wouldn't start with Drupal and Services 3.x if the only end need is to build a RESTful service. They are not generic solution to build a data backend with a RESTful API. They should be used when what is needed is a CMS powered website exposing (parts of) its data through a RESTful API.
Upvotes: 8
Reputation: 20150
If you are looking for a good framework to built a RESTful architecture, I would greatly suggest:
1. Recess Framework Well, recess is great, you direct routes to functions through URL and redirect control to other functions. It has a simple ORM that allows you to do great things in little time.
2. Fat-Free Framework I've not used F3 but i know its simple, well-documented, allows routing for restful architecture and has its ORM
Upvotes: 2
Reputation: 941
Drupal Services 3.0 makes creating REST services much easier than it was with the previous versions (2.x). Also Services 3.0 works with Drupal 6 and Drupal 7.
Upvotes: 3
Reputation: 1512
I haven't worked with Drupal 7 for such purposes, but over the summer I was tasked with building a RESTful service in Drupal 6. Drupal 6 is fairly ill-suited to developing web services: the data model is built around content nodes, and the theming system is built around returning rendered HTML, so you wind up fighting with the framework a fair amount.
The Services module is decent, but ultimately, we went with Django Piston. Developing the service in Piston took far less time and was reliable and performant.
Upvotes: 2