-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
75 lines (49 loc) · 1.78 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
GAE-DJ implemented a RESTful api for GAE database writing/reading and
also for other GAE funny things like url fetching.
It's designed particularly for cross-domain javascript access.
check /static/*.html as demos.
author:[email protected]
========database api=======
create(must login) or modify(must be creator) model:
get /model/[MODEL_NAME]?[PARAS]
PARAS can be:
keys=key1,key2,key3,... (required)
canread=[all(default)|author|owner]
canwrite=[all(default)|author|owner]
canedit=[all|author(default)|owner]
insert record:
get/post /post/[MODEL_NAME]?data={JSON}
modify record:
get/post /modify/[MODEL_NAME]?data={JSON}
view record(s):
get /view/[MODEL_NAME]/[KEY]/[VALUE]?op=[eq(default)|gt|lt|in]
example:
get /view/mm/marks/S'
get /view/mm/marks/B_C_D?op=in'
delete record:
get /delete/[MODEL_NAME]/[ID]
========fetch url===========
get/post /fetch?data={JSON}
data is:
url: (required)
method: GET|POST|PUT|DELETE|HEAD
fields: {"key":"value"} (for POST/PUT)
headers:{'Content-Type': 'application/x-www-form-urlencoded'}
decode: GBK|...
response:
{'content':result.content,
'truncated':result.content_was_truncated,
'status_code':result.status_code}
=======user profile==========
get /profile
response:{"loginurl":"localhost:8080", "user":"[email protected]"}
********************how to use js client******************
just check /static/*.html as demos!
<script type="text/javascript" src="/static/gae-dj.js"></script>
var dj = new Gaedj();
dj.send('model/mm?keys=name,height',function(r){
alert('try to make a model:'+r.success)
});
dj.send('fetch?data={"url":"http://g.cn/", "decode":"gbk"}',function(r){
$('#con').html(r.content)
})