rest

What's the correct way to view idempotency in terms of HTTP DELETE?

I have spent a lot of time recently reading the HTTP 1.1 specification and relating it to REST. I have found that there are two interpretations of the HTTP DELETE method in regards to its "idempotency" and safety. Here are the two camps: If you delete a resource with HTTP DELETE, and it succeeds (200 OK), and then you try to delete tha...

Password reset using Restful Authentication

Hello, wondering if someone has code or plugin for enabling password reset with Restful Authentication? I came across the following tutorial, but looking for either confirmation or alternatives: http://railsforum.com/viewtopic.php?pid=74245#p74245 Thank you. ...

Law of Demeter vs. REST

The Law of Demeter (really should be the suggestion of Demeter) says that you shouldn't "reach through" an object to get at their child objects. If you, as a client, need to perform some non-trivial operation, most of the time the domain model you're working with should support that operation. REST is in principle a dumb hierarchy of o...

What is the proper "Rails Way" to consume a RESTful web service on another domain?

I would like to write a Ruby on Rails application that consumes a RESTful web service API performs some logic on the result and then displays that data on my view. For example, let's say I wanted to write a program that did a search on search.twitter.com. Using pure ruby I might create the following method: def run(search_term='', las...

Best Way to Test Rails REST XML API?

I want to test the REST api on my Rails site. What is the easiest/best way to do this with the rails testing framework? I'm only doing the standard resourceful stuff, so I am wondering in particular, since this is so bog standard, if there is any automagical way to test this stuff. ...

Load multiple event feeds with one GData calendar query.

So, my problem is as such... I'm building a simple calendar module for my company's intranet portal. We use Google (Apps for your Domain) Calendar and I'd like to give the employees the ability to see all the feeds they've subscribed to in one calendar--just like on the real Google Calendar! The reason I'm not just using the the gadge...

Get resource name from URL when using a custom controller in Rails

Hi, I have a set of routes that are generated dynamically at runtime, but that all point to the same controller i.e. map.resources :authors, :controller => 'main' map.resources :books, :controller => 'main' These all work fine, producing routes like /authors/1, /books, /books/55, etc and then all end up being processed by the 'main' ...

Period in RESTful WCF Starter Kit

I am using RESTful WFC's WebInvoke and WebGet attribute classes. In the UriTemplate parameter I want to capture a variable which includes the period character. How do I do so? So [WebInvoke(Method = "PUT", UriTemplate = "{id}")] [OperationContract] TItem UpdateItemInXml(string id, TItem newValue); I would like it to matc...

Subsonic REST 404 error

I'm trying to use the REST interface with Subsonic, but am not having any luck. I have this in the web.config <httpHandlers> <add type="SubSonic.WebUtility.RESTHandler, Subsonic" path=".xml" verb="*"/> </httpHandlers> and just to test that I have a version of Subsonic that has this functionality, this works fine (doesn't do any...

Reading custom HttpWebResponse StatusDescription?

I'm setting a custom StatusDescription in a RESTful WCF service when an exception is thrown. It's meant to provide the caller with a friendly description of why they got the failure status code. The following is the response I see in Fiddler. So I know that my custom message is getting pushed back through to the caller. What I can't ...

Better way to make this case REST

Imagine this case: A color has an id. Easy enough. The same color can, depending on the user's language pref, search query and personal preference have a different display name. This display name is not defining, but it needs to be passed on to each page so the user is confronted with the same label every time the color is mentioned. Fu...

Identity columns and security in a RESTful web application

Question Should autoincremented identity columns have a non-default seed/increment when used in a RESTful web application? Background I'm working on my first ASP.NET MVC application and trying to keep my urls RESTful. There is no separate administrative web site for the application. I use attributes to control who can access what pa...

How do I create a new HttpSession in a RESTful webapp ?

I have a need to create a HttpSession (via cookie) whenever a client invokes a particular UI. Assumptions: Let's assuming that I'm not going to worry about any deep oAuth-like authentication dance. JESSIONSID cookie impersonation is not an issue for now. The server is tomcat, thus a JSESSIONID cookie is sent down to the client if a n...

What web APIs would you most want to replicate or are the most popular?

Soap, REST, xmlrpc. Facebook, twitter, [insert web 2.0 site]. What is the definitive web API and which would be the one that you would most likely replicate in your own code and for what reason? It seems that some web APIs invoke nausea in developers while other invoke pure worship. If you were told to develop an API for a website/pro...

What should be the default version if I have many versions for a REST api ?

I have a REST api that will accept a version via a custom HTTP header or a request parameter. I'm doing this because I don't want the URI to contain the version like del.icio.us .e.g http://server/api/v1/... Now in my design, the HTTP header has a higher priority than the request param. What happens then if the user does not supply any ...

How to interpret HTTP Accept headers ?

According to the HTTP1.1 spec, an Accept header of the following Accept: text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c is interpreted to mean text/html and text/x-c are the preferred media types, but if they do not exist, then send the text/x-dvi entity, and if that does not exist, send the text/plain entity Let's cha...

Pagination in a REST web application

This is a more generic reformulation of this question (with the elimination of the Rails specific parts) I am not sure how to implement pagination on a resource in a RESTful web application. Assuming that I have a resource called products, which of the following do you think is the best approach, and why: 1. Using only query strings e...

Are there any naming convention guidelines for REST APIs?

When creating REST APIs, are there any guidelines or defacto standards for naming conventions within the API (eg: URL endpoint path components, querystring parameters)? Are camel caps the norm, or underscores? others? For example: api.service.com/helloWorld/userId/x or api.service.com/hello_world/user_id/x Note: This is not a que...

Using HTTP OPTIONS to retrieve information about REST resources

This problem relates to the Restlet framework and Java When a client wants to discover the resources available on a server - they must send an HTTP request with OPTIONS as the request type. This is fine I guess for non human readable clients - i.e. in code rather than a browser. The problem I see here is - browsers (human readable) ...

URL layout for shared activities

My application currently has a very simple URL layout: map.resource :account, :controller => "users", :only => [:show, :update, :destroy] map.resources :workouts do |workout| workout.resource :chart, :only => [:show] workout.resources :taggings, :only => [:destroy, :create] end Giving me nice easy urls for the current user. I'm...