Changes between Initial Version and Version 1 of baby3_developers/interface


Ignore:
Timestamp:
12/19/2014 11:04:00 AM (11 years ago)
Author:
lianchijin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • baby3_developers/interface

    v1 v1  
     1[[TOC]] 
     2 
     3== 一.基本约定 == 
     4 
     5{{{ 
     6  1.基本约定 
     7   
     8  1.当接口处理正常时,HTTP STATUS CODE 返回给200。包括有正常的业务数据和数据为空的情况。 
     9   
     10  2.当接口处理异常时,HTTP STATUS CODE 返回给500,并且给出具体的错误信息。 
     11      { 
     12    "uri" : "/intf/albums-by-type.jsp", 
     13    "error-desc":"Need you follow uid.", 
     14          "user-notice":"给用户的提示放在这里" 
     15      }` 
     16       
     17  3.接口默认的字符编码是UTF-8,接口需要实现对req-enc和resp-enc参数的支持。在JSP的最顶部,实现类似下面的代码: 
     18   
     19          String queryString = request.getQueryString(); 
     20          String requestEncoding = getParam(queryString,"req_enc"); 
     21          String responseEncoding = getParam(queryString,"resp_enc"); 
     22          if(isNotBlank(requestEncoding)){ 
     23              request.setCharacterEncoding(requestEncoding); 
     24          } 
     25          if(isNotBlank(responseEncoding)){ 
     26              response.setCharacterEncoding(responseEncoding); 
     27          } 
     28   
     29  4.所有有写操作的数据接口,必须用POST方式提交,在接口里需要判断提交方式,拒绝GET的调用请求。 
     30   
     31  5.接口中的JSON字符串,key都用双引号("")包裹,value是字符串类型时,也用双引号("")包裹;是数字类型时,不用引号 
     32   
     33  6.需要分页的接口,统一返回以下字段:  pageNo,pageSize,total 
     34}}} 
     35 
     36== 二.接口列表 ==