restful-url

How to create REST URL's without verbs?

I'm struggling to determine how to design restful URLs. I'm all for the restful approach of using URLs with nouns and not verbs don't understand how to do this. We are creating a service to implement a financial calculator. The calculator takes a bunch of parameters that we will upload via a CSV file. The use cases would involve: U...

Restful URLs with data in query string or request body?

What's the rule of thumb for passing data in a REST URL in the query string vs. the body of a request? Ie: You're creating a service to add hockey players. You could go with: PUT /players { "name": Gretzky } or PUT /players?name=Gretzky If you're passing a lot of data, you would need to go with option #1 as there is a limit on t...

How to obtain REST resource with different finder "methods"?

Let's say you had a /companies resource that allowed clients to lookup public companies and you wanted clients to be able to lookup companies by Ticker, Location, and Location and industry Would you keep the same URL in the form: GET /companies/msft GET /companies/usa GET /companies/usa&software This doesn't seem right. Any ideas? ...

How to "lazy load" in a RESTful manner?

Given this service to get information about a hotel: > GET /hotel/{id} < HTTP/1.1 200 OK < <hotel> < <a>aaa</a> < <b>aaa</b> > <biggie>aaa....I am 300K</biggie > < </hotel> Problem is that biggie is 300K and we don't want to return it with every response. What's the RESTful way to lazy load this value? Should we set up two ...

RESTful POSTS, do you POST objects to the singular or plural Uri?

Which one of these Uris would be more 'fit' for receiving POSTS (adding product(s))? Are there any best practices available or is it just personal preference? /product/ (singular) or /products/ (plural) Currently we use /products/?query=blah for searching and /product/{productId}/ for GETs PUTs & DELETEs of a single product. ...

Three Step Buyonline The RESTful way

We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let's say the three URL's are; /step1.aspx /step2.aspx /step3.aspx Each step is pretty autonomous and don't require data from any of the other steps. The questi...

Nested Routes and Parameters for Rails URLs (Best Practice)

Hey there, I have a decent understanding of RESTful urls and all the theory behind not nesting urls, but I'm still not quite sure how this looks in an enterprise application, like something like Amazon, StackOverflow, or Google... Google has urls like this: http://code.google.com/apis/ajax/ http://code.google.com/apis/maps/documentat...

What is the difference between category/category_id/item_id and category?category_id={}&item_id={} in REST?

I just began looking at REST and was wondering what the basic difference between the two representations was. The first one looks pretty nice to me and the second one has to pass some attribute values but the underlying logic seems to be boiling to almost the same thing (I could be mistaken though) http://url/category/category_id/item_i...

RESTful URLs for a search service with an arbitrary number of filtering criteria

I want to build a RESTful web service that implements a search interface for a database of biological data. A typical search request could involve a dozen or so attributes of the data. For example, search by scientific name, constrain the search to water depths less than 100m. My first instinct is to have all of the attributes in the...

MVC:RESTful routing with nested urls, when entities are not really nested

I 'm really having a hard time with the RESTful paradigm + nested urls. I have asked a question that lead me to where I am right now here. My Domain is roughly this: there are schools, courses of a school and teachers of schools. Now schools, courses and teacher are not "nested" entities in the sense that you can refer to any of them wit...

Why does including an action verb in the URI in a REST implementation violate the protocol?

I'm finding it necessary to understand why including action verbs in the URI violates the REST protocol for URI syntax? When I read the following article, I sense that too many people are making too much noise about verbs, and that they should be making more noise about content types: RestWiki: Minimum Methods In a perfect world, clien...

How do you handle RESTful URL parameters in a Ruby on Rails application?

I am dealing with a very simple RESTful Rails application. There is a User model and I need to update it. Rails coders like to do: if @user.update_attributes(params[:user]) ... And from what I understand about REST, this URL request should work: curl -d "first_name=tony&last_name=something2&v=1.0&_method=put" http://localhost:3000/...

is restful meant for web services only OR for both web services AND web pages?

I read a lot of Restful tutorials for PHP. (I don't want to go in depth into why I am not using RoR. It is due to the team being more familiar with PHP) Because we are planning for future expansion into having APIs i read that it is important to implement Restful web services. I have looked at tutorials such as http://www.gen-x-des...

REST services - exposing non-data "actions"

I understand how to use REST for doing general entity interactions - using urls names to map to entities and the HTTP verbs to map to actions on those entities. But what is the generally accepted way of looking at "actions" more like RPC? For example, let's say I want to send a command for the device to reset? There's no real "entit...

How do I create a Spring 3 + Tiles 2 webapp using REST-ful URLs?

I'm having a heck of a time resolving URLs with Spring 3.0 MVC. I'm just building a HelloWorld to try out how to build a RESTful webapp in Spring, nothing theoretically complicated. All of the examples I've been able to find are based on configurations that pay attention to file extensions ("*.htm" or "*.do"), include an artificial dir...

Best practices on using URIs as parameter value in REST calls.

I am designing a REST API where some resources can be filtered through query parameters. In some cases, these filter values would be resources from the same REST API. This makes for longish and pretty unreadable URIs. While this is not too much of a problem in itself because the URIs are meant to be created and manipulated programmatical...

Rails nested URL question

Hi Im having issues with RESTful URLs in Rails. I have site.com/services url, and I want to have subpages under that category, thats it: site.com/services/arquitecture, site.com/services/plumbing, etc. The pages that im serving under that category are "static" .rhtml files and I would want them to be on the same controller. Is there ...

Multiple query parameter RESTful URL with .htaccess

Hi all, I would like to use following RESTful URL for a web site I'm working on. http://mysite.com/Products/category=bags&amp;colours=black can anyone please tell me how to achieve this with .htaccess? Oscar ...

What's the best RESTful method to return total number of items in an object?

I'm developing a REST API service for a large social networking website I'm involved in. So far, it's working great. I can issue GET, POST, PUT and DELETE requests to object URLs and affect my data. However, this data is paged (limited to 30 results at a time). However, what would be the best RESTful way to get the total number of say, ...

Spring MVC: Correct Annotation of Controller Method for RESTful URI including ';'

Designing my RESTful API, I would like use following URI http://[HOST]/[PLANET]/[LAT];[LONG] e.g. http://myserver/earth/50.2;29.1 What is the appropiate annotation of a such a method in Spring MVC? Is this the following one ok? @RequestMapping(value = "/{planet}/{lat};{long}", method = RequestMethod.GET) public String showInfoAbou...