Skip to content

Commit fb4e931

Browse files
authored
Update Document-English.md
1 parent d7aced0 commit fb4e931

1 file changed

Lines changed: 286 additions & 0 deletions

File tree

Document-English.md

Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,289 @@
1+
### Examples:
2+
3+
#### Get a User
4+
Request:
5+
<pre><code class="language-json">{
6+
"User":{
7+
 }
8+
}
9+
</code></pre>
10+
11+
[Click here to test](http://apijson.cn:8080/get/{"User":{}})
12+
13+
Response:
14+
<pre><code class="language-json">{
15+
"User":{
16+
"id":38710,
17+
"sex":0,
18+
"name":"TommyLemon",
19+
"certified":true,
20+
"tag":"Android&Java",
21+
"phone":13000038710,
22+
"head":"http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000",
23+
"date":1485948110000,
24+
"pictureList":[
25+
"http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000",
26+
"http://common.cnblogs.com/images/icon_weibo_24.png"
27+
]
28+
},
29+
"code":200,
30+
"msg":"success"
31+
}
32+
</code></pre>
33+
34+
<br />
35+
36+
<p align="center" >
37+
<a >[GIF] APIJSON single objects: simple queries, statistics, groups, orders, aggregations, comparisons, filters, aliases, etc.</a>
38+
</p>
39+
40+
![](https://raw.githubusercontent.com/TommyLemon/StaticResources/master/APIJSON/APIJSON_query_single.gif)
41+
42+
#### Get an Array of Users
43+
44+
Request:
45+
<pre><code class="language-json">{
46+
"[]":{
47+
  "count":3,             //just get 3 results
48+
  "User":{
49+
    "@column":"id,name" //just get ids and names
50+
  }
51+
}
52+
}
53+
</code></pre>
54+
55+
[Click here to test](http://apijson.cn:8080/get/{"[]":{"count":3,"User":{"@column":"id,name"}}})
56+
57+
Response:
58+
<pre><code class="language-json">{
59+
"[]":[
60+
{
61+
"User":{
62+
"id":38710,
63+
"name":"TommyLemon"
64+
}
65+
},
66+
{
67+
"User":{
68+
"id":70793,
69+
"name":"Strong"
70+
}
71+
},
72+
{
73+
"User":{
74+
"id":82001,
75+
"name":"Android"
76+
}
77+
}
78+
],
79+
"code":200,
80+
"msg":"success"
81+
}
82+
</code></pre>
83+
84+
<br />
85+
86+
<p align="center" >
87+
<a >[GIF] APIJSON single arrays: simple queries, statistics, groups, orders, aggregations, paginations, searches, regexps, combinations, etc.</a>
88+
</p>
89+
90+
![](https://raw.githubusercontent.com/TommyLemon/StaticResources/master/APIJSON/APIJSON_query_array.gif)
91+
92+
93+
#### Get a Moment and its publisher
94+
Request:
95+
<pre><code class="language-json">{
96+
"Moment":{
97+
},
98+
"User":{
99+
"id@":"Moment/userId" //User.id = Moment.userId
100+
}
101+
}
102+
</code></pre>
103+
104+
[Click here to test](http://apijson.cn:8080/get/{"Moment":{},"User":{"id@":"Moment%252FuserId"}})
105+
106+
Response:
107+
<pre><code class="language-json">{
108+
"Moment":{
109+
"id":12,
110+
"userId":70793,
111+
"date":"2017-02-08 16:06:11.0",
112+
"content":"1111534034"
113+
},
114+
"User":{
115+
"id":70793,
116+
"sex":0,
117+
"name":"Strong",
118+
"tag":"djdj",
119+
"head":"http://static.oschina.net/uploads/user/585/1170143_50.jpg?t=1390226446000",
120+
"contactIdList":[
121+
38710,
122+
82002
123+
],
124+
"date":"2017-02-01 19:21:50.0"
125+
},
126+
"code":200,
127+
"msg":"success"
128+
}
129+
</code></pre>
130+
131+
<br />
132+
133+
#### Get a Moment list like Twitter tweets
134+
Request:
135+
<pre><code class="language-json">{
136+
"[]":{ //get an array
137+
"page":0,                     //pagination
138+
"count":2,
139+
"Moment":{                     //get a Moment
140+
"content$":"%a%"          //filter condition: content contains 'a'
141+
},
142+
"User":{
143+
    "id@":"/Moment/userId",       //User.id = Moment.userId, short referrence path,starts from grandparents path
144+
"@column":"id,name,head" //get specified keys with the written order
145+
},
146+
"Comment[]":{ //get a Comment array, and unwrap Comment object
147+
"count":2,
148+
"Comment":{
149+
"momentId@":"[]/Moment/id" //Comment.momentId = Moment.id, full referrence path
150+
}
151+
}
152+
}
153+
}
154+
</code></pre>
155+
156+
[Click here to test](http://apijson.cn:8080/get/{"[]":{"page":0,"count":2,"Moment":{"content$":"%2525a%2525"},"User":{"id@":"%252FMoment%252FuserId","@column":"id,name,head"},"Comment[]":{"count":2,"Comment":{"momentId@":"[]%252FMoment%252Fid"}}}})
157+
158+
Response:
159+
<pre><code class="language-json">{
160+
"[]":[
161+
{
162+
"Moment":{
163+
"id":15,
164+
"userId":70793,
165+
"date":1486541171000,
166+
"content":"APIJSON is a JSON Transmission Structure Protocol…",
167+
"praiseUserIdList":[
168+
82055,
169+
82002,
170+
82001
171+
],
172+
"pictureList":[
173+
"http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000",
174+
"http://common.cnblogs.com/images/icon_weibo_24.png"
175+
]
176+
},
177+
"User":{
178+
"id":70793,
179+
"name":"Strong",
180+
"head":"http://static.oschina.net/uploads/user/585/1170143_50.jpg?t=1390226446000"
181+
},
182+
"Comment[]":[
183+
{
184+
"id":176,
185+
"toId":166,
186+
"userId":38710,
187+
"momentId":15,
188+
"date":1490444883000,
189+
"content":"thank you"
190+
},
191+
{
192+
"id":1490863469638,
193+
"toId":0,
194+
"userId":82002,
195+
"momentId":15,
196+
"date":1490863469000,
197+
"content":"Just do it"
198+
}
199+
]
200+
},
201+
{
202+
"Moment":{
203+
"id":58,
204+
"userId":90814,
205+
"date":1485947671000,
206+
"content":"This is a Content...-435",
207+
"praiseUserIdList":[
208+
38710,
209+
82003,
210+
82005,
211+
93793,
212+
82006,
213+
82044,
214+
82001
215+
],
216+
"pictureList":[
217+
"http://static.oschina.net/uploads/img/201604/22172507_aMmH.jpg"
218+
]
219+
},
220+
"User":{
221+
"id":90814,
222+
"name":7,
223+
"head":"http://static.oschina.net/uploads/user/51/102723_50.jpg?t=1449212504000"
224+
},
225+
"Comment[]":[
226+
{
227+
"id":13,
228+
"toId":0,
229+
"userId":82005,
230+
"momentId":58,
231+
"date":1485948050000,
232+
"content":"This is a Content...-13"
233+
},
234+
{
235+
"id":77,
236+
"toId":13,
237+
"userId":93793,
238+
"momentId":58,
239+
"date":1485948050000,
240+
"content":"This is a Content...-77"
241+
}
242+
]
243+
}
244+
],
245+
"code":200,
246+
"msg":"success"
247+
}
248+
</code></pre>
249+
250+
<p align="center" >
251+
<a >[GIF] APIJSON query multi related tables: one to one, one to many, many to one, various conditions, etc.</a>
252+
</p>
253+
254+
![](https://raw.githubusercontent.com/TommyLemon/StaticResources/master/APIJSON/APIJSON_query_associate.gif)
255+
256+
<br />
257+
258+
<p align="center" >
259+
<a >[GIF] APIJSON joins: < LEFT JOIN, & INNER JOIN, etc.</a>
260+
</p>
261+
262+
![](https://raw.githubusercontent.com/TommyLemon/StaticResources/master/APIJSON/APIJSON_query_join.gif)
263+
264+
<br />
265+
266+
<p align="center" >
267+
<a >[GIF] APIJSON subqueries:@from@ FROM, key@ =, key>@ >, key{}@ IN, key}{@ EXISTS, etc.</a>
268+
</p>
269+
270+
![](https://raw.githubusercontent.com/TommyLemon/StaticResources/master/APIJSON/APIJSON_query_subquery.gif)
271+
272+
<br />
273+
274+
<p align="center" >
275+
<a >[GIF] APIJSON: a set of some features, simple to complex</a>
276+
</p>
277+
278+
![](https://raw.githubusercontent.com/TommyLemon/StaticResources/master/APIJSON/APIJSON_query_summary.gif)
279+
280+
<br />
281+
282+
[Test it online](http://apijson.cn/api)
283+
284+
<br />
285+
<br />
286+
1287
## API Design Rules
2288

3289
### 1. Methods and API endpoints

0 commit comments

Comments
 (0)