开发者

Is it ideal to call 3 times to the webservice to get data in RESTful model or once and get all it together - IN MOBILE APPLICATION?

We are developing a mobile application(iPhone, Android, WM) which mainly connects with the server using RESTful services. We are in the process of developing the webservices which are RESTful. The question here is .. we have a details window for the customer where he sees his basic info, comments by others, his comments, votes etc. All these are stored in different tables in database.

The Urls are designed like this 开发者_运维技巧now..

/User/<UserId>/ -- To get basic info
/User/<UserId>/Comments -- To get the comments
/User/<UserId>/Votes -- to get the votes

Is it ideal to call 3 times to the server from the mobile app and get info separately or get everything together in one call in proper xml/json format? The concern here is the performance and also we dont want to break the the importance of RESTful webservices?

What do you suggest?


Since RESTful applications depend on caching for performance, you have to strike a balance: larger messages can mean fewer requests due to cache misses, while smaller messages can mean less bandwidth overall. Smaller messages may also be required to maintain proper cache invalidation boundaries. I previously gave a similar answer that might also help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜