Normally when you query the WebApi for a specific record you'll always get a JSON response back that contains the entity field values at the time of the query.
If your code queries the same record using the WebApi many times then this can introduce overhead that will slow down your code. To combat this, we often introduce elaborate caching schemes but this leads to the challenge of keeping the cache current.
The good news is that the Xrm.WebApi SDK already implements a cache for us inside the retreiveRecord call using the ETag.
Consider a call to retrieveRecord as follows:
The first call will retrieve the record from the server including the ETag value
"name": "Sample Account Mon, 31 Dec 2018 10:36:56 GMT",
The @odata.etag is then used to build a cache of the response that is dependant on the fields that are retrieved.
When you next query for the same record with the same $select attributes the client SDK will send the value of the Etag in the request header:
If the record has not been modified since then the server will return:
HTTP/1.1 304 Not Modified
This indicates that the client side SDK can then reuse the same record that was retrieved previously.
Since it would be quite complex to implement this feature in your hand-build HTTP requests, this is indeed a good reason to use the Xrm.WebApi SDK!
Happy 2019! 😊