[[TOC]] == 1.基本约定 == {{{ 1.当接口处理正常时,HTTP STATUS CODE 返回给200。包括有正常的业务数据和数据为空的情况。 2.当接口处理异常时,HTTP STATUS CODE 返回给500,并且给出具体的错误信息。 { "uri" : "/intf/albums-by-type.jsp", "error-desc":"Need you follow uid.", "user-notice":"给用户的提示放在这里" }` 3.接口默认的字符编码是UTF-8,接口需要实现对req-enc和resp-enc参数的支持。在JSP的最顶部,实现类似下面的代码: String queryString = request.getQueryString(); String requestEncoding = getParam(queryString,"req_enc"); String responseEncoding = getParam(queryString,"resp_enc"); if(isNotBlank(requestEncoding)){ request.setCharacterEncoding(requestEncoding); } if(isNotBlank(responseEncoding)){ response.setCharacterEncoding(responseEncoding); } 4.所有有写操作的数据接口,必须用POST方式提交,在接口里需要判断提交方式,拒绝GET的调用请求。 5.接口中的JSON字符串,key都用双引号("")包裹,value是字符串类型时,也用双引号("")包裹;是数字类型时,不用引号。 }}} == 2.接口列表 == === 2.1 优惠/发现 分类接口 === (维护:成荣伟) {{{ url:http://best.pconline.com.cn/intf/iphone/getTopicType.jsp HTTP请求方式:get 是否需要登录:否 提交参数:isIndex:是否首页分类,1表示是,0表示不是,默认0 参数说明: 返回数据: { "order": [ //排序(发现页) { "name": "最新发现", //分类名字 "id": "0", //分类ID,用于2.2中的topicId参数 "imageSrc": "www.pconline.com.cn", //图标 "imageSrcPressed": "www.pconline.com.cn" //被选中的图标 }, { "name": "最热发现", "url": "www.pconlien.com.cn", "id": "0", "imageSrc": "www.pconline.com.cn", "imageSrcPressed": "www.pconline.com.cn" } ], "category": [ //优惠分类 { "name": "优惠精选", "id": "123", "imageSrc": "www.pconline.com.cn", "imageSrcPressed": "www.pconline.com.cn" }, { "name": "数码家电", "id": "124", "imageSrc": "www.pconline.com.cn", "imageSrcPressed": "www.pconline.com.cn" } ] } }}} === 2.2文章列表接口 === (维护:成荣伟) {{{ url:http://best.pconline.com.cn/intf/iphone/getTopicList.jsp 请求参数: pageNo:页码,默认1 pageSize:每页显示记录数,默认20 recommendIndex:是否推荐首页,默认0不推荐 topicTypeId:分类ID mallId:电商ID(可选) 请求方法:get 是否需要登录:否 返回参数: { "pageCount":9, //分页数 "pageNo":1, //页码 "pageTotal":35, // 数据总数 "topicTypeId: 0, //分类ID "focus": [ { "id": "", "title": "", "image": "", "invalid": 1 } ], "topics":[ //数据 { "commentNum":"0", //评论数 "id":"2395585", "title":"有钱你就来", //标题 "image":"http://img0.pcauto.com.cn/pcauto/1303/15/2395585_1.png", //图片 "pubDate":"2013-02-03", //时间 "good":"20", //值的数量 "bad":"1", //不值的数量 "price":"只售998,还包邮~" //价格 "deprecated":1 //是否过期 currentPrice = "0.00"; //现在价格 discount = "0.0折"; //打折数 formerPrice = "0.00"; //之前价格 “eb”:"电商名称", } ], "pageSize":"20" //每页数据数 } }}} === 2.3 终端页接口 === (维护:成荣伟、制作:甘剑威) {{{ url:http://best.pconline.com.cn/intf/iphone/getTopicHtml.jsp 请求参数: topicId:爆料ID type:爆料类型 common_session_id: 登录后session,Cookies中 请求方法:get 是否需要登录:否 返回参数:web页面的html代码 备注: 附加信息用注释的方式放到html代码里面以/*@_HTML_META_START_开头, _HTML_META_END_@*/结尾,里面的内容有评论url,标题以及发送微博用的图片url,用json格式,例如: 收藏按钮点击跳转协议: pcation://collect/id 取消收藏按钮点击跳转协议: pcation://uncollect/id }}} === 2.4 评论列表接口 === (客户端通用) {{{ url:http://mrobot.pconline.com.cn/v3/cmt/new_topics HTTP请求方式:get 是否需要登录:否 提交参数: topicId: 评论id articleId: 文章id 返回数据: { "comments": [ { //没有引用其他评论的评论 "1": { //表达其引用关系的key "id":"24991904",//帖子id "name": "不是网易的江苏省盐城市网友 帅气飞扬: ", //用户名称 "floor": "1737", //楼层 "time": "2013-01-05 09:05:40", //时间 "content": "内容过于暴力,已和谐" //内容 }, "current":"1", //当前最外层引用标识 "support":"10086" //"顶"数量 "expand":false //判断是否展开,默认为false }, { "3": { "id":"24991804",//帖子id "name": "不是网易的江苏省盐城市网友 帅气飞扬: ", "floor": "1737", "time": "2013-01-05 09:05:40", "content": "内容过于暴力,已和谐" }, "2": { "id":"24941904",//帖子id "name": "不是网易的江苏省盐城市网友 帅气飞扬: ", "floor": "1737", "time": "2013-01-05 09:05:40", "content": "内容过于暴力,已和谐" }, "1": { "id":"24491904",//帖子id "name": "不是网易的江苏省盐城市网友 帅气飞扬: ", "floor": "1737", "time": "2013-01-05 09:05:40", "content": "内容过于暴力,已和谐" }, "4": { "id":"24993904",//帖子id "name": "不是网易的江苏省盐城市网友 帅气飞扬: ", "floor": "1737", "time": "2013-01-05 09:05:40", "content": "内容过于暴力,已和谐" }, "current":"4", "support":"10086" //顶数 "expand":false //判断是否展开,默认为false } ], "hot-comments": [ { //没有引用其他评论的评论 "1": { //表达其引用关系的key "id":"24691904",//帖子id "name": "不是网易的江苏省盐城市网友 帅气飞扬: ", //用户名称 "floor": "1737", //楼层 "time": "2013-01-05 09:05:40", //时间 "content": "内容过于暴力,已和谐" //内容 }, "current":"1" "support":"10086" //顶数 "expand":false //判断是否展开,默认为false } ], "docUrl": "http://im_an_artical" } 备注: }}} === 2.5 发评论接口 === (客户端通用) {{{ http://cmt.pcauto.com.cn/action/comment/create_utf8.jsp HTTP请求方式:post 是否需要登录:否 提交参数:id:话题id url:话题url common_session_id:太平洋通行证session username:用户名 anonymous:是否匿名 content:内容 replyFloor2:回复楼层(可选) 通过body传参 返回数据: { "commentId":25705754, "floor":27, "showName":"iostester", "brief":"Really good car hm~~~", "status":0, "createTime":"2013-07-19 10:37:03", "resultCode":0, "resultMsg":"您的评论已经成功发表。注:评论在审核后才能出现在列表中,谢谢!", "userId":25520497 } }}} === 2.6 值不值接口 === (维护:成荣伟) {{{ url:http://best.pconline.com.cn/intf/iphone/likeAndDislike.jsp 请求参数: topicId:爆料ID operate:值或不值,0表示值,1表示不值 common_session_id:太平洋通行证session (当有登录时发,无登录时不发) 请求方法:get 是否需要登录:否 返回参数: { "resultCode":0, "resultMsg":"您的投票已经成功发表。注:评论在审核后才能出现在列表中,谢谢!" } }}} === 2.7 摇一摇接口 === (维护:成荣伟) {{{ url:http://best.pconline.com.cn/intf/iphone/getTopicListOfTop.jsp 备注:摇一摇接口出文章列表规则:当前时间算24小时内首页接口文章最新的100篇,不足100篇的话有多少出多少,时间按发布时间排序,不分页. 请求参数: 无 请求方法:get 是否需要登录:否 返回参数: { "pageCount":"1", "pageNo":"1", "data":[ { "commentNum":"0", "id":"2395585", "title":"“BMW大师殿堂”杨丽萍舞剧《孔雀》在陕西惊艳登场", "image":"http://img0.pcauto.com.cn/pcauto/1303/15/2395585_1.png", "pubDate":"2013-02-03", //时间 "wroth":"1", //值的数量 "price":"160元包邮" //价格 } ], "pageSize":"20" } }}} === 2.8 太平洋统一登录接口 === (客户端通用) {{{ url:http://mrobot.pcauto.com.cn/proxy/passport2/login 备注: 请求参数:username:用户名 password:密码 请求方法:post 是否需要登录:否 返回参数: { "status": 0, "message": "ok", "session": "123456", "userId": 25520497, "common_session_id": "123456" } }}} === 2.9 晒单首页 === {{{ url:http://www.pconline.com.cn/jrzcz/app/1311/intf3741.js 备注: 请求参数: 请求方法:get 是否需要登录:否 返回参数: { topics: [ 帖子数组 { id: 48074, id image: "http://img0.pconline.com.cn/pconline/jrzcz/1311/28525424_1384151163247_0_1024x1024.jpg", 导读图 title: "晒屌丝破车升级20寸轮毂+土豪邻居新车", 标题 time: "2013-11-13" 发表时间 } ] } }}} === 3.0 晒单终端 === {{{ url:http://mrobot.pconline.com.cn/best/topics/45049?pageNo=1 备注: 请求参数:id_0:帖子id, pageNo:页数, authorId:为0时查看全部,为楼主id时只看楼主 请求方法:get 是否需要登录:否 }}} === 3.1 回帖 === {{{ url:http://piebbs.pconline.com.cn/rest/topics/${topicId} 备注: 请求参数: agent = 1; message = 内容; replyToId = 31202601; 设置header Cookie = "common_session_id=xxxx"; 请求方法:post 是否需要登录:否 返回参数: }}} === 3.2 搜索 === {{{ url:http://best.pconline.com.cn/intf/iphone/searchResult.jsp 参数:
keyword 搜索关键词(会去除前后空格)String
 recommendIndex 优惠1/发现0 int 
pageNo 页号 int topicTypeId 搜索海淘分类时,才用这个参数,固定值13 
pageSize 页大小(默认20) 请求方法:get 是否需要登录:否 返回参数: { "pageCount":9, //分页数 "pageNo":1, //页码 "pageTotal":35, // 数据总数 "pagesize "topics":[ //数据 { "commentNum":"0", //评论数 "id":"2395585", "title":"有钱你就来", //标题 "image":"http://img0.pcauto.com.cn/pcauto/1303/15/2395585_1.png", //图片 "pubDate":"2013-02-03", //时间 "good":"20", //值的数量 "bad":"1", //不值的数量 "price":"只售998,还包邮~" //价格 "deprecated":1 //是否过期 currentPrice = "0.00"; //现在价格 discount = "0.0折"; //打折数 formerPrice = "0.00"; //之前价格 } ], "pageSize":"20" //每页数据数 } }}} === 3.3 搜索热词 === {{{ url:http://www.pconline.com.cn/jrzcz/app/1311/intf3722.js 备注: 请求参数: 请求方法:get 是否需要登录:否 返回参数: }}} == V1.2.0用到的接口 == === 4.0 获取收藏列表 === {{{ url:http://192.168.50.32:8082/intf/iphone/getCollectsForApp.jsp 参数: common_session_id: 登录后session,Cookies中 topicTypeId: 类型(海淘、经验、晒物) recommendIndex:推荐类型(0优惠、1发现) pageNo: pageSize: 请求方法:get 是否需要登录:否 返回参数: { "products": [ { "id": 123, “title”: "", "time": "", "price": "", "eb": "",(电商名称) "image": "http://xxx", "invalid": (1已失效,0未失效) } ], "pageNo": 1, "pageSize": 20, "total": 100 } 晒物和经验没有的字段,填入空字符串 }}} === 4.1 添加收藏 === {{{ url:http://192.168.50.32:8082/intf/iphone/collectForApp.jsp 参数: common_session_id: 登录后session,Cookies中 topicId:12312 type: 类型(1优惠、2发现、3海淘、4经验、5晒物)//暂时不用 请求方法:post 是否需要登录:否 返回参数: { "result": { "status": (1成功,0失败), "msg": (失败后的提示) } } }}} === 4.2 删除收藏 === {{{ url:http://192.168.50.32:8082/intf/iphone/deleteCollectForApp.jsp 参数: common_session_id: 登录后session,Cookies中 topicIds:12312,57847 id的串,用逗号分隔,可单个可多个 type: 类型(1优惠、2发现、3海淘、4经验、5晒物)//暂时不用 请求方法:post 是否需要登录:否 返回参数: { "result": { "status": (1成功,0失败), "msg": (失败后的提示) } } }}} === 5.0 海淘电商分类列表 === {{{ url:http://best.pconline.com.cn/intf/iphone/getMall.jsp HTTP请求方式:get 是否需要登录:否 参数说明: 格式与2.1的接口一致 返回数据: { "mall": [ { "iconImg": "", "id": 1, "name": "京东", "typeDesc": "国内", "typeId": 0 }, { "iconImg": "", "id": 2, "name": "苏宁易购", "typeDesc": "国内", "typeId": 0 }, { "iconImg": "", "id": 3, "name": "易迅", "typeDesc": "国内", "typeId": 0 }, { "iconImg": "", "id": 4, "name": "亚马逊中国", "typeDesc": "国内", "typeId": 0 }, { "iconImg": "", "id": 5, "name": "天猫", "typeDesc": "国内", "typeId": 0 }, { "iconImg": "", "id": 6, "name": "1号店", "typeDesc": "国内", "typeId": 0 }, { "iconImg": "", "id": 7, "name": "美国亚马逊", "typeDesc": "国外", "typeId": 1 }, { "iconImg": "", "id": 8, "name": "日本亚马逊", "typeDesc": "国外", "typeId": 1 }, { "iconImg": "", "id": 9, "name": "当当", "typeDesc": "国内", "typeId": 0 }, { "iconImg": "", "id": 10, "name": "国美在线", "typeDesc": "国内", "typeId": 0 }, { "iconImg": "", "id": 11, "name": "库巴", "typeDesc": "国内", "typeId": 0 }, { "iconImg": "", "id": 12, "name": "淘宝", "typeDesc": "国内", "typeId": 0 } ] } }}} === 2.2文章列表接口 === (维护:成荣伟) {{{ url:http://best.pconline.com.cn/intf/iphone/getTopicList.jsp 请求参数: pageNo:页码,默认1 pageSize:每页显示记录数,默认20 recommendIndex:是否推荐首页,默认0不推荐 topicTypeId:分类ID mallId:电商ID(可选) 请求方法:get 是否需要登录:否 返回参数: { "pageCount":9, //分页数 "pageNo":1, //页码 "pageTotal":35, // 数据总数 "topicTypeId: 0, //分类ID "focus": [ { "id": "", "title": "", "image": "", "invalid": 1 } ], "topics":[ //数据 { "commentNum":"0", //评论数 "id":"2395585", "title":"有钱你就来", //标题 "image":"http://img0.pcauto.com.cn/pcauto/1303/15/2395585_1.png", //图片 "pubDate":"2013-02-03", //时间 "good":"20", //值的数量 "bad":"1", //不值的数量 "price":"只售998,还包邮~" //价格 "deprecated":1 //是否过期 currentPrice = "0.00"; //现在价格 discount = "0.0折"; //打折数 formerPrice = "0.00"; //之前价格 “eb”:"电商名称", } ], "pageSize":"20" //每页数据数 } }}} === 6.0 我的消息数 === {{{ url:http://192.168.50.32:8082/intf/iphone/myNewsForApp.jsp 参数: common_session_id: 登录后session,Cookies中 blTime:上次访问爆料时间,格式为:(YYYY-MM-DD HH:mm:ss) plTime:上次访问评论时间, 格式为:(YYYY-MM-DD HH:mm:ss) 请求方法:post 是否需要登录:否 返回参数: { "blCount":100 爆料数量 "plCount":100 评论数量 } }}} === 7.0 我的爆料 === {{{ url:http://192.168.50.32:8082/intf/iphone/myTipoffForApp.jsp 参数: common_session_id: 登录后session,Cookies中 pageNo: pageSize: status: 状态(1表示请求审核已经通过的列表,2表示请求未通过的列表) typeId: 类型(1优惠、2发现、3海淘、4经验、5晒物)//暂时不用 请求方法:get 是否需要登录:是 返回参数: { "list": [ { "id": 123, "url": "", "time": 12312312, "title": "this is the brief of the post", "image": "http://xxx", "status": -1(1已通过,0审核中,-1不通过,说明:如果参数status请求时设置为1,此处应该全部是1) "reason": "抄袭!" }, { "id": 123, "url": "", "time": 12312312, "title": "this is the brief of the post", "image": "http://xxx", "status": 1(1已通过,0审核中,-1不通过) "award": "奖励5金币", } ] } }}} === 8.0 签到 === {{{ url:http://192.168.50.32:8082/intf/iphone/signInForApp.jsp 参数: common_session_id: 登录后session,Cookies中 请求方法:post 是否需要登录:是 返回参数: { "status": 1(1成功,0失败,2已签到) "msg":"签到成功", “day”: 2,(已签到次数) “addCoin”:2,(金币增加) "addInt"4,(积分增加) “gold”:100,(金币总数) "point"100,(积分总数) } }}} === 9.0用户基本信息 === {{{ url:http://192.168.50.32:8082/intf/iphone/myInfoForApp.jsp 参数: common_session_id: 登录后session,Cookies中 userId 请求方法:get 是否需要登录:是 返回参数: { "name":"用户名", "gold":50, "point"100, "status":(1成功,0是登录,-1是未登录) } }}} === 10.0专题接口 === {{{ url: 参数: 请求方法:get 是否需要登录:是 返回参数:HTML页面 跳转协议: 晒单终端页(帖子终端页)pconlinebestbuy://best-buy-show-order-terminal/id 商品终端页(文章终端页)pconlinebestbuy://best-buy-article/id }}} === 11.0 订阅列表 === {{{ url:http://192.168.50.32:8082/intf/iphone/subscription_list.jsp 参数: 请求方法:get 是否需要登录:是 返回参数: { list:[ { id: name: img: } ] } }}} === 12.0 订阅 === {{{ url:http://192.168.50.32:8082/intf/iphone/subscription_add.jsp 参数: token: ids: beginTime: endTime: open: (1发推送,0不发推送) 请求方法:post 是否需要登录:是 返回参数: }}}