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 resources:
> GET /hotel/{id}
< HTTP/1.1 200 OK
< <hotel>
< <a>aaa</a>
< <b>aaa</b>
< </hotel>
and..
> GET /hotel/{id}/biggie
< HTTP/1.1 200 OK
< <biggie>
< <val>aaa....I am 300K</val>
< </biggie>
And you only request GET /hotel/{id}/biggie when you really need that data?
This would work.. although there is nothing special about biggie except that it's a large data set. I think it's nicer to keep everything at the hotel level as all the attributes are really just attributes of the hotel.