[GSoC Proposal] Improving RESTful Web Services

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
sepgil's picture

Overview

RestWS is a module which allows Drupal to expose it’s data as RESTful web services. This project aims to improve the module to a stable state, by fixing some bugs and adding new important features.

Description

Providing Drupal’s entities as web services allows you to access and modify it from external applications. That application could be an android app that allows users to sync contacts with Drupal or an IOS application which allows you to delete spam comments from a custom comment overview. The module could also be used to expose commerce customer profiles to a third party e-commerce application or to migrate other data to external platforms.
While there are other web service modules like Services, RestWS offers a simple and lightweight approach to expose resources from Drupal, by making use of the Entity API. Every entity is therefore supported out of the box and can be accessed via the same path pattern (for nodes: "/nodes/1" or for users: "/user/1" and so on). The data format is defined by the HTTP accept headers, so if the client requests JSON or XML instead of HTML, it will get it.
This allows site builders to easily add web service interfaces to existing frameworks like Drupal Commerce or eRecruiter (since both of them make heavy use of entities), without having to configure a lot stuff or writing any additional code.

Following features and bug fixes would be implemented in this course:

  • Fix XML bugs
  • Fix data format requests
  • Fix create entities problems
  • Fix media integration
  • Improve create and update operations, so that it matches the read operation format
  • Add versioned services support
  • Add additional entity querying methods
  • Add additional authentication methods
  • Improve rules integration

If you have any other ideas you can of course post them here, and I’ll consider to add them

Detail

Here are the details to the tasks that I would have to do. Some tasks still need discussion and I therefore will open new issues in the RestWS issue queue, so that everyone can can post their opinions.

  • Fix XML bugs
    It seems that there are some problems with the XML output. A bug fix for that will probably be one of the first things I would implement.
  • Fix create entities problems
    RestWS allows you to create entities without having to speicify all options (like if a node should be sticky or not), but certain options like bundles need to be specified, otherwise certain pages like the entity overviews will break. Thats another bug I'll have to fix.
  • Fix data format requests
    I noticed that there are some cases, where the data format requested by the client is not returned, like on HTTP 404 or 403 errors. Since this breaks the principles of RestWS, this issue will have high priority for me.
  • Fix media integration
    Currently RestWS has problems returning the path of media files, so I’ll have to fix that too.
  • Add versioned services support
    If for example fields are added or deleted from a node type, the client needs to know that something has changed. By keeping track of node type versions, that problem could be solved. However, how this should be implemented is currently open for debate.
  • Improve Create and update so that the formats matches the read format.
    The formats which is used to create or update a entities, differs from the those which are returned when you request an entity. The author of a node for example, is returned as a sub-object (when using JSON) with the uri, the id and the resource type (since it is a reference to another resource). When you add a new node however, the author is simply passed as an numeric value, which represents the id. This should be fixed so that RestWS uses an uniform format for all operations for each entity.
  • Add additional entity querying methods
    While RestWS allows you to create, read, update and delete entities, currently there is no way to search for entities or to return all entity ids for a specific type. This seems to be a perfect fit for EntityFieldQuery to retrieve results. I’ll add those two features, but currently it is open how RestWS will limit the results (pagination?).
  • Add additional authentication methods
    Currently you can only either authenticate using cookies or using the add-on module that comes with RestWS, that authenticates users via HTTP basic authentication. I would like to implement OAuth, so that people can restrict what they would like to share over the services, although its currently not entirely clear how to implement that.
  • Improve rules integration
    Having own events for RestWS (e.g. “A web service has created a new node”) would be very use full, so that would be the last task to implement.

Schedule

Since University in Austria doesn't ends until end of June, I would do most of the work in July and August, just like the years before.

  • May 21
    Fix create entities problems
    Fix data format requests
    Fix XML Bugs
  • June 18
    Fix media integration
    Improve Create and update so that the formats matches the read format.
  • July 9 [Module is stable Milestone]
    MidTerm Submission
    [Begin to add new features]
    Add additional entity querying methods
    Add versioned services support
    Add additional authentication methods
    Improve rules integration
  • August 6
    Improve Tests, write documentation
  • August 24
    Final evaluation deadline

Who

My name is Sebastian and I'm a student from the Vienna University of Technology. I’ve been working with Drupal for almost 3 Years and contributed code to modules like Transformations, Pageroute and Rules and also have created modules like Autocomplete Deluxe and Rules Link. Some of them were made during past Google Summer of Code courses, which I successfully completed. Although I haven’t worked much with web services until now, I got enough experience with Drupal and Entity API. Therefore I’m sure I’m the right man for the job.

Mentor

klausi (author of RestWS)

Screencast

Here a screencast with the outcome of this project:
http://youtu.be/Mr4jwnvUyaU

Comments

Update: I've added two issues

sepgil's picture

Update:
I've added two issues to the RestWS issue queue and linked them in my proposal.
I've also implemented a basic android client, to checkout what's missing and what could be improved in RestWS.
You can find the source code here:
https://github.com/sepal/RestWSApp

I have signed up as GSoC

klausi's picture

I have signed up as GSoC mentor and I would love to work with you on this project. I am the maintainer of RestWS and agree on all the points you would like to work on. This would be a great improvement for RestWS!

What's about index, query,

olragon's picture

What's about index, query, search operations? Any plans?

Yes, that is planned in the

klausi's picture

Yes, that is planned in the proposal.

That features are planned

sepgil's picture

That features are planned under the point
Add additional entity querying methods

Google Summer of Code 2012

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: