Implementation of new features
DrSlump - April 2, 2009 - 14:21
| Project: | REST Server |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Jump to:
Description
Hi,
I've added quite a few new features to the module and I was wondering if you would like to incorporate them. Attached you'll find the new code which adds the following features:
- Multiple response serialization formats:
- XML (as the original version)
- JSON
- XMLRPC (Responses use the XMLRPC serialization format for data and errors)
- PHP (the ouput of the serialize() function)
- Default response format is XML but it can be changed (in order of precedence) with the format request argument, extension suffix on resource (ie: /menu/get.json) or the Accept HTTP header
- Response HTTP codes are either 200 (ok), 403 (Not authorized to access the resource) or 404 (method not found)
- Method to call can be part of the path (/services/rest/:service/:method). ie: /services/rest/menu/get (if method is supplied in the request params it overrides the path)
- Arguments can be included in the path following the order in which they are defined (/services/rest/:service/:method/:arg1/:arg2/:arg3) ie: /services/rest/menu/get/primary-links/link_path,link_title (but if they are set as request params they have precedence)
- If there is a request without a sessid argument it will be served as an anonymous request instead of being rejected
By the way, I've just tested against D6 (but everything should work on D5).
cheers,
Ivan
| Attachment | Size |
|---|---|
| rest_server.module.gz | 2.73 KB |

#1
Hi Ivan,
I just became co-maintainer for rest_server, and to mark that occasion we started off a 6.x-2.x development branch. It is a complete rewrite, and does much of the stuff that you suggest, and then some. Version 2 of REST depends on a pending patch to services (http://drupal.org/node/466922) that makes it possible to properly implement a REST server, so it's not possible to use it with any released version of services yet. But the source is up, both in CVS and on github: http://github.com/hugowetterberg/rest_server/tree/master so you're more than welcome to look at it, try it out and submit idéas and suggestions.
So, this might be a case of "won't fix", but that's up to Rob to decide.
Cheers
/Hugo
#2
What could happen is a merge in of the individual features proposed here. Would have to go by a case-by-case patch though. So, in the mean time, I'll set this to patch-needs-work. I really like where you're going here though!