@@ -206,11 +206,11 @@ APIJSON是一种JSON传输结构协议。<br />
206206
207207 客户端对应不同需求的请求 | 传统方式 | APIJSON
208208-------- | ------------ | ------------
209- User | http://localhost:8080/user?id=1 | http://localhost:8080/{"User":{"id":1}}
210- User和对应的Work | 分两次请求<br />User: http://localhost:8080/user?id=1 <br />Work: http://localhost:8080/work?userId=1 | http://localhost:8080/{"User":{"id":1} , "Work":{"userId@":"User/id"}}
211- User列表 | http://localhost:8080/user/list?page=1&count=5&sex=0 | http://localhost:8080/{"[ ] ":{"page":1, "count":5, "User":{"sex":0}}}
212- type为1的Work列表,每个Work包括发布者User和前3条Comment | Work里必须有User的Object和Comment的Array<br /> http://localhost:8080/work/list?page=1&count=5&type=1&commentCount=3 | http://localhost:8080/{"[ ] ":{"page":1, "count":5, "Work":{"type":1}, "User":{"workId@":"/Work/id"}, "[ ] ":{"count":3, "Comment":{"workId@":"[ ] /Work/id"}}}}
213- 1个User发布的Work列表,每个Work包括发布者User和前3条Comment | 把以上请求里的type=1改为userId=1 | 有以下几种方法:<br />①把以上请求里的"Work":{"type":1}, "User":{"workId@":"/Work/id"}改为"User":{"id":1}, "Work":{"userId@":"/User/id"}<br /><br />②或这样省去4条重复User<br />http://localhost:8080/{"User":{"id":1} , "[ ] ":{"page":1, "count":5, "Work":{"userId@":"User/id"}, "[ ] ":{"count":3, "Comment":{"workId@":"[ ] /Work/id"}}}}<br /><br />③如果User之前已经获取到了,还可以这样省去所有重复User<br />http://localhost:8080/{"[ ] ":{"page":1, "count":5, "Work":{"userId":1}, "[ ] ":{"count":3, "Comment":{"workId@":"[ ] /Work/id"}}}}
209+ User | http://localhost:8080/get/ user?id=1 | http://localhost:8080/get /{"User":{"id":1}}
210+ User和对应的Work | 分两次请求<br />User: http://localhost:8080/get/ user?id=1 <br />Work: http://localhost:8080/get/ work?userId=1 | http://localhost:8080/get /{"User":{"id":1} , "Work":{"userId@":"User/id"}}
211+ User列表 | http://localhost:8080/get/ user/list?page=1&count=5&sex=0 | http://localhost:8080/get /{"[ ] ":{"page":1, "count":5, "User":{"sex":0}}}
212+ type为1的Work列表,每个Work包括发布者User和前3条Comment | Work里必须有User的Object和Comment的Array<br /> http://localhost:8080/get/ work/list?page=1&count=5&type=1&commentCount=3 | http://localhost:8080/get /{"[ ] ":{"page":1, "count":5, "Work":{"type":1}, "User":{"workId@":"/Work/id"}, "[ ] ":{"count":3, "Comment":{"workId@":"[ ] /Work/id"}}}}
213+ 1个User发布的Work列表,每个Work包括发布者User和前3条Comment | 把以上请求里的type=1改为userId=1 | 有以下几种方法:<br />①把以上请求里的"Work":{"type":1}, "User":{"workId@":"/Work/id"}改为"User":{"id":1}, "Work":{"userId@":"/User/id"}<br /><br />②或这样省去4条重复User<br />http://localhost:8080/get/ {"User":{"id":1} , "[ ] ":{"page":1, "count":5, "Work":{"userId@":"User/id"}, "[ ] ":{"count":3, "Comment":{"workId@":"[ ] /Work/id"}}}}<br /><br />③如果User之前已经获取到了,还可以这样省去所有重复User<br />http://localhost:8080/get /{"[ ] ":{"page":1, "count":5, "Work":{"userId":1}, "[ ] ":{"count":3, "Comment":{"workId@":"[ ] /Work/id"}}}}
214214
215215 服务端对应不同请求的返回结果 | 传统方式 | APIJSON
216216-------- | ------------ | ------------
0 commit comments