@@ -276,7 +276,7 @@ APIJSON是一种JSON传输结构协议。<br />
276276 Moment和对应的User | 分两次请求<br />Moment: base_url/get/moment?userId=1<br />User: base_url/get/user?id=1 | [ base_url/get/{"Moment":{"userId":1}, "User":{"id":1}}] ( http://139.196.140.118:8080/get/{"Moment":{"userId":38710},"User":{"id":38710}} )
277277 User列表 | base_url/get/user/list?page=0&count=3&sex=0 | [ base_url/get/{"[ ] ":{"page":0, "count":3, "User":{"sex":0}}}] ( http://139.196.140.118:8080/get/{"[]":{"page":0,"count":3,"User":{"sex":0}}} )
278278 Moment列表,每个Moment包括发布者User和前3条Comment | Moment里必须有User的Object和Comment的Array<br /> base_url/get/moment/list?page=0&count=3&commentCount=3 | [ base_url/get/{"[ ] ":{"page":0, "count":3, "Moment":{}, "User":{"id@":"/Moment/userId"}, "[ ] ":{"count":3, "Comment":{"momentId@":"[ ] /Moment/id"}}}}] ( http://139.196.140.118:8080/get/%7B%22%5B%5D%22%3A%7B%22Moment%22%3A%7B%7D%2C%22User%22%3A%7B%22id%40%22%3A%22%252FMoment%252FuserId%22%7D%2C%22Comment%5B%5D%22%3A%7B%22Comment%22%3A%7B%22momentId%40%22%3A%22%255B%255D%252FMoment%252Fid%22%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%7D )
279- User发布的Moment列表,每个Moment包括发布者User和前3条Comment | Moment里必须有User的Object和Comment的Array<br /> base_url/get/moment/list?page=0&count=3&commentCount=3&userId=1 | 有以下几种方法:<br />①把以上请求里的"Moment":{}, "User":{"momentId@":"/Moment/id"}改为["Moment":{"userId":1}, "User":{"id":1}](http://139.196.140.118:8080/get/%7B%22%5B%5D%22%3A%7B%22Moment%22%3A%7B%22userId%22%3A38710%7D%2C%22User%22%3A%7B%22id%22%3A38710%7D%2C%22%5B%5D%22%3A%7B%22Comment%22%3A%7B%22momentId%40%22%3A%22%255B%255D%252FMoment%252Fid%22%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%7D) <br /><br />②或这样省去4条重复User<br />[base_url/get/{"User":{"id":1}, "[]":{"page":0, "count":3, "Moment":{"userId":1}, "[]":{"count":3, "Comment":{"momentId@":"[]/Moment/id"}}}}](http://139.196.140.118:8080/get/%7B%22User%22%3A%7B%22id%22%3A38710%7D%2C%22%5B%5D%22%3A%7B%22Moment%22%3A%7B%22userId%22%3A38710%7D%2C%22%5B%5D%22%3A%7B%22Comment%22%3A%7B%22momentId%40%22%3A%22%255B%255D%252FMoment%252Fid%22%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%7D)<br /><br />③如果User之前已经获取到了,还可以这样省去所有重复User<br />[base_url/get/{"[]":{"page":0, "count":3, "Moment":{"userId":1}, "[]":{"count":3, "Comment":{"momentId@":"[]/Moment/id"}}}}](http://139.196.140.118:8080/get/%7B%22%5B%5D%22%3A%7B%22Moment%22%3A%7B%22userId%22%3A38710%7D%2C%22%5B%5D%22%3A%7B%22Comment%22%3A%7B%22momentId%40%22%3A%22%255B%255D%252FMoment%252Fid%22%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%7D)
279+ User发布的Moment列表,每个Moment包括发布者User和前3条Comment | Moment里必须有User的Object和Comment的Array<br /> base_url/get/moment/list?page=0&count=3&commentCount=3&userId=1 | 有以下几种方法:<br />①把以上请求里的"Moment":{}, "User":{"id@":"/Moment/userId"}改为["Moment":{"userId":1}, "User":{"id":1}](http://139.196.140.118:8080/get/%7B%22%5B%5D%22%3A%7B%22Moment%22%3A%7B%22userId%22%3A38710%7D%2C%22User%22%3A%7B%22id%22%3A38710%7D%2C%22%5B%5D%22%3A%7B%22Comment%22%3A%7B%22momentId%40%22%3A%22%255B%255D%252FMoment%252Fid%22%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%7D) <br /><br />②或这样省去4条重复User<br />[base_url/get/{"User":{"id":1}, "[]":{"page":0, "count":3, "Moment":{"userId":1}, "[]":{"count":3, "Comment":{"momentId@":"[]/Moment/id"}}}}](http://139.196.140.118:8080/get/%7B%22User%22%3A%7B%22id%22%3A38710%7D%2C%22%5B%5D%22%3A%7B%22Moment%22%3A%7B%22userId%22%3A38710%7D%2C%22%5B%5D%22%3A%7B%22Comment%22%3A%7B%22momentId%40%22%3A%22%255B%255D%252FMoment%252Fid%22%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%7D)<br /><br />③如果User之前已经获取到了,还可以这样省去所有重复User<br />[base_url/get/{"[]":{"page":0, "count":3, "Moment":{"userId":1}, "[]":{"count":3, "Comment":{"momentId@":"[]/Moment/id"}}}}](http://139.196.140.118:8080/get/%7B%22%5B%5D%22%3A%7B%22Moment%22%3A%7B%22userId%22%3A38710%7D%2C%22%5B%5D%22%3A%7B%22Comment%22%3A%7B%22momentId%40%22%3A%22%255B%255D%252FMoment%252Fid%22%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%2C%22count%22%3A3%2C%22page%22%3A0%7D%7D)
280280
281281### <h3 id =" 2.6 " >2.6 服务端对应不同请求的返回结果<h3 />
282282 服务端对应不同请求的返回结果 | 传统方式 | APIJSON
@@ -289,10 +289,11 @@ APIJSON是一种JSON传输结构协议。<br />
289289
290290
2912911.base_url指基地址,一般是顶级域名,其它分支url都是在base_url后扩展。如base_url:http://www.google.com/ ,对应的GET分支url:http://www.google.com/get/ ,下同。<br >
292- 2.status,指返回结果中的状态码,200表示成功,其它都是错误码,值全部都是HTTP标准状态码。下同。<br >
293- 3.message,指返回结果中的状态信息,对成功结果或错误原因的详细说明。下同。<br >
294- 4.status和message总是在返回结果的同一层级成对出现。对所有请求的返回结果都会在最外层有一对总结式status和message。对非GET、HEAD请求,返回结果里面的每个JSONObject里都会有一对status和message说明这个JSONObject的状态。下同。<br >
295- 5.id等字段对应的值仅供说明,不一定是数据库里存在的,请求里用的是真实存在的值。下同。
292+ 2.请求中的 / 需要转义。JSONRequest.java已经用URLEncoder.encode转义,不需要再写;但如果是浏览器或Postman等直接输入url/request,需要把request中的所有 / 都改成 %252F ,下同。<br >
293+ 3.status,指返回结果中的状态码,200表示成功,其它都是错误码,值全部都是HTTP标准状态码。下同。<br >
294+ 4.message,指返回结果中的状态信息,对成功结果或错误原因的详细说明。下同。<br >
295+ 5.status和message总是在返回结果的同一层级成对出现。对所有请求的返回结果都会在最外层有一对总结式status和message。对非GET、HEAD请求,返回结果里面的每个JSONObject里都会有一对status和message说明这个JSONObject的状态。下同。<br >
296+ 6.id等字段对应的值仅供说明,不一定是数据库里存在的,请求里用的是真实存在的值。下同。
296297
297298## <h2 id =" 3 " >3.请求方法、URL、Request、Response对应关系总览<h2 />
298299
0 commit comments