wiki:pcauto_pconline_4.0.0/intf/leijingtang

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 /newMsgCount

    HTTP请求方式:get                         
    是否需要登录:否                          
    请求参数:none
    返回参数:
    { "newMsgCount": 2000 }
    newMsgCount:新消息的数量,当该数值超过五位数时,只返回99999。新消息是指汽车论坛的站内信,不包括认证失败的消息。

2.2  http://mrobot.pconline.com.cn/v2/cms/channels/1 &&  http://mrobot.pcauto.com.cn/v2/cms/channels/1

    HTTP请求方式:get
    是否需要登录:否
    请求参数
    {
    "topArticle":[

        {
            "pubDate":"2013-03-20",
            "title":"专利败诉 HTC再度悲剧……",
            "updateAt":1363708800000,
            "to-uri":"pconlinebrowser://bbs-topic/16348932",
            "preView":"专利败诉 HTC再度悲剧……",
            "seq":15,
            "image":"http://img0.pconline.com.cn/pconline/1303/20/3220919_f3.jpg",
            "floorCount":15    // 楼层数
        },
        {
            "pubDate":"2013-03-11",
            "title":"摄影部落美图——《日出赛罕坝》",
            "updateAt":1362931200000,
            "to-uri":"pconlinebrowser://album-photo/9792",
            "preView":"摄影部落美图——《日出赛罕坝》",
            "seq":20,
            "image":"http://img0.pconline.com.cn/pconline/1303/11/3209641_f2.jpg",
            "numCount":20    //  图集的图片张数
        }
    ],
    "articleList":[
        
    ],
    "topFocus":[
    ]
}
    备注:除topArticle外的数据,其他都不变,topArticle里面的论坛和图集分别增加一个楼层数和图集张数的字段