open api 的接口能不能重新设计,方便使用?
如下是 Testerhome 提供的接口,但是如果需要转换成 javabean的时候,这时候就麻烦了,没有规律,所有接口外面强制使用的 jsonobject 设计.
但是里面节点的名字又是不同的,这样设计对应的 javabean的时候就需要设计很多重复的.
{
"nodes": [
{
"id": 1,
"name": "Ruby",
"topics_count": 1692,
"summary": "Ruby 是一门优美的语言",
"section_id": 1,
"sort": 0,
"section_name": "Ruby",
"updated_at": "2015-03-01T22:35:21.627+08:00"
},
...
]
}
其实这样的接口我感觉,设计成下面这样是不是更好点:
[{
"id": 1,
"name": "Ruby",
"topics_count": 1692,
"summary": "Ruby 是一门优美的语言",
"section_id": 1,
"sort": 0,
"section_name": "Ruby",
"updated_at": "2015-03-01T22:35:21.627+08:00"
},
...
]
或获取用户信息
{
"id": 1,
"login": "chenhengjie123",
"name": "a",
"avatar_url": "http://gravatar.com/avatar/357a20e8c56e69d6f9734d23ef9517e8.png?s=120",
"location": "",
"company": null,
"twitter": null,
"website": "",
"bio": "",
"tagline": "",
"github": "",
"created_at": "2015-02-28T20:09:58.183+08:00",
"email": "a@b.com",
"topics_count": 8,
"replies_count": 33,
"following_count": 1,
"followers_count": 0,
"favorites_count": 3,
"level": "admin",
"level_name": "管理员"
}