基于REST框架为Android,iOS的......?框架、REST、iOS、Android

2023-09-12 06:56:11 作者:扬玖尘

我公司改造该公司的 API 并希望让一切权利这个时候;)多数民众赞成在设置...

My company is reworking its API and wants to make everything RIGHT for this time ;) Thats the setup...

我们正在将数据传送到客户在互联网上。 在客户端的手机,例如iPhone,机器人,J2ME,黑莓...... 服务器为codeD上的Ruby on Rails

我们想通过一个框架...

以在客户端上使用的ActiveResource的。 在该框架应做的连接(REST),分析和(动态)提供的模型 牌照必须是开源的。 在授权应包括在内。我们使用OAuth和需要提供的访问令牌上的任何请求。也许作为参数或在HTTP标头? HTTPS / SSL支持 分页和关系(与延迟加载)的支持将是巨大的! Otherwize框架必须能够被调整为这些事情。

我们已经发现了以下框架和恳请你们来评价他们。也许你们中的一个使用了一些人或一些不同的东西...

We already have found following frameworks and kindly ask you guys to evaluate them. Maybe one of you used some of them or something different...

Android版本: RESTProvider从Novoda /卡尔十六世古斯塔夫Harroch 提供商提供从Android和RESTProvider自动分析的RESTful API响应成提供数据源的抽象。 RESTProvider是所有常用重新实现功能的实现时,在Android的Web服务处理。用户可以无缝地与任何Web服务API提供JSON或XML作为响应接口。要查询RESTProvider一项活动,用户只需指定一个端点,然后查询一个REST风格的API函数。 RESTProvider还可以处理所有的HTTP查询和放大器;缓存。 有没有发现太多的文件以外的其他 提供的缓存以及 在发行+文档计划于2011年初

的iOS: http://iphoneonrails.com/ 库为iOS和Rails之间的通信 REST风格和的ActiveResource为本 在包括XML / JSON解析器 免费许可 在分页?,?,Android的延迟加载? Android的:Hand与由SQLLite DB 支持使用游标发办法 意图是非常高性能和Android的最佳实践 使用游标 Android: Hand made approach with the use of cursors backed by a SQLLite DB intended to be very performant and best practice of Android uses cursors Android的:Spring Android的休息模板模块 在Spring的RestTemplate是一个强大的,流行的基于Java的REST客户端。春天的Andr​​oid休息模板模块提供了一个版本RestTemplate的是在Android环境中工作。 Android的:你总是应该看看认真思考关于REST Android: You always should take a look at this video of Google IO 2010 when thinking serious about REST Android版本:饲料框架 com.google.android.feeds 类的集合,以帮助您构建内容提供商。该框架是专门设计来帮助您的应用程序连接到Web的API。

推荐答案

我是RESTProvider的作者。还是非常早期的阶段,所以我不建议使用它在生产中。我一直在使用它的几个项目,正在生产中,但我适应大部分的code特定需求。我将努力让在今年年底公开稳定的API。

I am the author of the RESTProvider. Still very early stage so I would not recommend to use it in production. I have been using it on several projects which are in production but I adapted most the code to specific needs. I will try to get a public stable API by the end of the year.

在关于返工的API,我建议如下:

In regards to reworking the API, I would suggest the following:

在用gzip COM pression 使用ETag的缓存 使用标准没有修改(我看到的情况下命名的oauth_token改为my_token这使得大多数图书馆没用无需修改) - 的OAuth / REST 使用创建/修改的时间戳,为了使缓存客户端(SQLite的冲突条款)远程ID的所有对象: {为MyObject:{createdAt:XXXX,RID:散列值}} 4A。使用一个很好的方法来确定返回的对象为用户/活动/应用:OpenSocial的应用应用程序ID+用户名+活动ID preFER JSON在XML preFER简单(最低深度可能) 返回完整的对象,一到该对象中的许多关系: {父:....  有:{完整的对象不只是ID} } 请不要返回的ID只(类:[2,3,4]应该是类:[{名:测试,ID:2},{名:生产,ID:3}}) 在考虑每次调用相互独立(IE的我应该有足够的信息对呼叫 http://test.com/object.json 来填充我的看法) Use GZip compression Use ETags for caching Use standards with no modification (I saw cases where the naming changed from oauth_token to my_token which makes most library useless without modification) - OAuth/REST Use creation/modified timestamp and remote ids for all objects in order to enable caching client side (SQLite conflict clauses): {"myobject": {"createdAt": xxxx, "rid": "hashvalue"}} 4a. Use a good way to identify the object returned for user/activity/application: opensocial uses "application id" + "user id" + "activity id" Prefer JSON over XML Prefer simplicity (lowest depth possible) Return the full object with the one to many relationship within that object: {"parent":.... "has": {"full object not just the ID"} } Don't return IDs only ( "category": [ 2,3,4] should be "category": [{"name": "testing", "id": 2},{"name": "production", "id": 3 }} ) Consider each call to be independent of each other (i.e. I should have enough information for call http://test.com/object.json to populate my views)

有关文件: 1.提供测试服务器 2.提供卷曲测试 3.提供的Java / PHP脚本示例/红宝石等...

For documentation: 1. provide test servers 2. provide cUrl for testing 3. provide sample scripts in java/php/ruby etc...

这一切都是我能想到的现在。我要补充这个ontop为我配备了更多的建议。

That s all I can think for now. I might add ontop of this as I come with more suggestion.