Concerning retrieval of data with RESTful web services:
HTTP may not be limiting the amount of data you can retrieve - after all, you can download very large files over HTTP.
However, due to performance issues, you may want to limit the amount of data retrieved for instance when constructing a list or some overview of the available resources and later allow users to further drill down into details. You can use the following methods to accomplish this:
If you are retrieving a representation of objects structured in a tree you can limit the depth using a parameter in the URL. Representation of resources at a depth deeper than the depth supplied are not provided, instead the URI of the resource is inserted.
For example, you want to retrieve a customer list, but you are not interested in the orders associated with each customer, then set the depth to 1. If you later want to view an order that belongs to a certain customer, then you retrieve it using the URI included in the representation of the customer list.
If the objects for which you want to retrieve a representation contain a lot of data in the root, you can:
- Use a parameter in the URL that indicates that you want to retrieve a lightweight representation of the data, only including certain key fields.
- Set up an additional resource being a lightweight version of the resource in question. I haven't tried this one and am a little skeptical regarding how to solve navigation between the lightweight version of the resource and the regular version.
Regarding limiting the amount of data when modifying existing resources:
You can implement the modification operation as to accept key data uniquely identifying a resource and limit the enclosed data to only the fields in the resource that are to be modified. For instance, if you want to modify the address of a customer, you issue a request containing a representation of a customer containing only the customer id and the new address. The result of the operation is that the address is modified while the other fields remain unchanged.
posted 10 years ago
Many Thanks Mikalai Zaikin and Ivan.
I understood that HTTP does not have limit but for performance we can drill the data and send accross.
SCJP 5, SCWCD 5, SCDJWS 5
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!