Re: [rest-discuss] Isn't the (practical) uri length limit a serious problem?
- On Oct 31, 2011, at 6:57 PM, Free Ekanayaka wrote:
> Hello,FWIW, I try to leverage domain concepts to define resources that correspond to sets of things (and combine those with query params for refinement).
> I have a real-life web service I can't see how to make an effective
> RESTful API for.
> We have a web application for system administrators that helps managing
> and monitoring a possibly very large number of computer machines in an
> organization (say 100k).
> Each computer registered in the system has an identifier, and I can get
> details about a single computer, like:
> GET /computers/1/temperature
> would return the CPU temperature of the computer with ID 1.
> Now, I need to have a mechanism to get the same information for an
> arbitrary large set of computers. So, I believe the most natural
> solution would be to encode the resource scoping information in the URI
> like this:
> GET /computers/1+2+3+4+5+6/temperature
> but of course this doesn't scale beyond a certain limit (the URI gets to
> large and hits the limits of the most popular HTTP servers).
> The alternative would be to first save your subset of computer IDs on
> the server by creating a new temporary resource with a PUT or a POST and
> then reference it in a GET. However this looks cumbersome, and leads to
> 2 requests when 1 would do it.
> Plus, if the service was meant to be read-only it wouldn't even be
> What would be a possible RESTful approach here?
In your case, you might want to look for machines that form sets, e.g. all-load-balancers, or all-nodes-on-floor-14, or whatever makes sense. It is pretty unlikely that you have a requirement to fetch information about a group of things without that group being somehow a domain concept, too.
> Free Ekanayaka
> PS: it seems that other people already have raised this issue, for
> example the real-life problem I described is a variation of the sample
> problem described here: