From f3494d79aa31653a6ea45add58dcca89784b4d03 Mon Sep 17 00:00:00 2001
From: TommyLemon <1184482681@qq.com>
Date: Mon, 27 Sep 2021 19:03:39 +0800
Subject: [PATCH] Update Document.md
---
Document.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Document.md b/Document.md
index 729b6c4d..0426f6b8 100644
--- a/Document.md
+++ b/Document.md
@@ -343,7 +343,7 @@ HEADS:
安全/私密获取数量,
用于获取银行卡数量等
新增数据 | base_url/post/ | 单个:
{
TableName:{
…
},
"tag":tag
}
{…}中id由后端生成,不能传
例如当前登录用户 38710 发布一个新 Comment:
[{
"Comment":{
"momentId":12,
"content":"APIJSON,let interfaces and documents go to hell !"
},
"tag":"Comment"
}](http://apijson.cn/api?url=http%3A%2F%2Fapijson.cn%3A8080%2Fpost&type=JSON&json={"Comment":{"momentId":12,"content":"APIJSON,let%20interfaces%20and%20documents%20go%20to%20hell%20!"},"tag":"Comment"})
后端校验通过后自动解析为 SQL 并执行:
`INSERT INTO Comment(userId,momentId,content) VALUES(38710,12,'APIJSON,let interfaces and documents go to hell !')`
批量:
{
TableName\[]:\[{
…
}, {
…
}
…
],
"tag":tag
}
{…}中id由后端生成,不能传
例如当前登录用户 82001 发布 2 个 Comment:
[{
"Comment[]":[{
"momentId":12,
"content":"APIJSON,let interfaces and documents go to hell !"
}, {
"momentId":15,
"content":"APIJSON is a JSON transmision protocol."
}],
"tag":"Comment:[]"
}](http://apijson.cn/api?url=http%3A%2F%2Fapijson.cn%3A8080%2Fpost&type=JSON&json={"Comment[]":[{"momentId":12,"content":"APIJSON,let%20interfaces%20and%20documents%20go%20to%20hell%20!"},{"momentId":15,"content":"APIJSON%20is%20a%20JSON%20transmision%20protocol."}],"tag":"Comment:[]"})
后端校验通过后自动解析为 SQL 并执行:
`INSERT INTO Comment(userId,momentId,content) VALUES(82001,12,'APIJSON,let interfaces and documents go to hell !')`
`INSERT INTO Comment(userId,momentId,content) VALUES(82001,15,'APIJSON is a JSON transmision protocol.')` | 单个:
{
TableName:{
"code":200,
"msg":"success",
"id":38710
},
"code":200,
"msg":"success"
}
例如
{
"Comment":{
"code":200,
"msg":"success",
"id":120
},
"code":200,
"msg":"success"
}
批量:
{
TableName:{
"code":200,
"msg":"success",
"count":5,
"id[]":[1, 2, 3, 4, 5]
},
"code":200,
"msg":"success"
}
例如
{
"Comment":{
"code":200,
"msg":"success",
"count":2,
"id[]":\[1, 2]
},
"code":200,
"msg":"success"
}
PUT:
修改数据,
只修改所传的字段 | base_url/put/ | {
TableName:{
"id":id,
…
},
"tag":tag
}
{…} 中 id 或 id{} 至少传一个
例如当前登录用户 82001 修改 id = 235 的 Moment 的 content:
[{
"Moment":{
"id":235,
"content":"APIJSON,let interfaces and documents go to hell !"
},
"tag":"Moment"
}](http://apijson.cn/api?url=http%3A%2F%2Fapijson.cn%3A8080%2Fput&type=JSON&json={"Moment":{"id":235,"content":"APIJSON,let%20interfaces%20and%20documents%20go%20to%20hell%20!"},"tag":"Moment"})
后端校验通过后自动解析为 SQL 并执行:
`UPDATE Moment SET content='APIJSON,let interfaces and documents go to hell !' WHERE id=235 AND userId=82001 LIMIT 1`
批量除了 id{}:\[] 也可类似批量 POST,只是每个 {...} 里面都必须有 id。
"tag":"Comment[]" 对应对象 "Comment":{"id{}":[1,2,3]},表示指定记录全部统一设置;
"tag":"Comment:[]" 多了冒号,对应数组 "Comment[]":[{"id":1},{"id":2},{"id":3}],表示每项单独设置 | 同POST
DELETE:
删除数据 | base_url/delete/ | {
TableName:{
"id":id
},
"tag":tag
}
{…} 中 id 或 id{} 至少传一个,一般只传 id 或 id{}
例如当前登录用户 82001 批量删除 id = 100,110,120 的 Comment:
[{
"Comment":{
"id{}":[100,110,120]
},
"tag":"Comment[]"
}](http://apijson.cn/api?url=http%3A%2F%2Fapijson.cn%3A8080%2Fdelete&type=JSON&json={"Comment":{"id{}":[100,110,120]},"tag":"Comment[]"})
后端校验通过后自动解析为 SQL 并执行:
`DELETE FROM Comment WHERE id IN(100,110,120) AND userId=82001 LIMIT 3` | {
TableName:{
"code":200,
"msg":"success",
"id[]":[100,110,120]
"count":3
},
"code":200,
"msg":"success"
}
例如
{
"Comment":{
"code":200,
"msg":"success",
"id[]":[100,110,120],
"count":3
},
"code":200,
"msg":"success"
}
-以上接口的简单形式:
base_url/{method}/{tag} | GET: 普通获取数据
base_url/get/{tag}
HEAD: 普通获取数量
base_url/head/{tag}
GETS: 安全/私密获取数据
base_url/gets/{tag}
HEADS: 安全/私密获取数量
base_url/heads/{tag}
POST: 新增数据
base_url/post/{tag}
PUT: 修改数据 base_url/put/{tag}
DELETE: 删除数据
base_url/delete/{tag} | 例如安全/私密获取一个 id = 82001 的 Privacy:
[base_url/gets/Privacy/
{"id":82001}](http://apijson.cn/api/?url=http%3A%2F%2Fapijson.cn%3A8080%2Fgets%2FPrivacy&type=JSON&json={"id"%3A82001})
相当于
[base_url/gets/
{"tag":"Privacy","Privacy":{"id":82001}}](http://apijson.cn/api/?url=http%3A%2F%2Fapijson.cn%3A8080%2Fgets&type=JSON&json={"tag"%3A"Privacy","Privacy"%3A{"id"%3A82001}})
例如批量修改 id = 114, 124 的 Comment 的 content:
[base_url/put/Comemnt[]/
{
"id{}":[114,124],
"content":"test multi put"
}](http://apijson.cn/api?url=http%3A%2F%2Fapijson.cn%3A8080%2Fput%2FComment[]&type=JSON&json={"id{}"%3A[114,124],"content"%3A"test%20multi%20put"})
相当于
[base_url/put/
{
"tag":"Comment[]",
"Comment":{
"id{}":[114,124],
"content":"test multi put"
}
}](http://apijson.cn/api?url=http%3A%2F%2Fapijson.cn%3A8080%2Fput&type=JSON&json={"tag"%3A"Comment[]","Comment"%3A{"id{}"%3A[114,124],"content"%3A"test%20multi%20put"}}) | 同以上对应的方法
+以上接口的简单形式:
base_url/{method}/{tag} | GET: 普通获取数据
base_url/get/{tag}
HEAD: 普通获取数量
base_url/head/{tag}
GETS: 安全/私密获取数据
base_url/gets/{tag}
HEADS: 安全/私密获取数量
base_url/heads/{tag}
POST: 新增数据
base_url/post/{tag}
PUT: 修改数据 base_url/put/{tag}
DELETE: 删除数据
base_url/delete/{tag} | 例如安全/私密获取一个 id = 82001 的 Privacy:
[base_url/gets/Privacy/
{"id":82001}](http://apijson.cn/api/?url=http%3A%2F%2Fapijson.cn%3A8080%2Fgets%2FPrivacy&type=JSON&json={"id"%3A82001})
相当于
[base_url/gets/
{"tag":"Privacy", "Privacy":{"id":82001}}](http://apijson.cn/api/?url=http%3A%2F%2Fapijson.cn%3A8080%2Fgets&type=JSON&json={"tag"%3A"Privacy","Privacy"%3A{"id"%3A82001}})
例如批量修改 id = 114, 124 的 Comment 的 content:
[base_url/put/Comemnt[]/
{
"id{}":[114,124],
"content":"test multi put"
}](http://apijson.cn/api?url=http%3A%2F%2Fapijson.cn%3A8080%2Fput%2FComment[]&type=JSON&json={"id{}"%3A[114,124],"content"%3A"test%20multi%20put"})
相当于
[base_url/put/
{
"tag":"Comment[]",
"Comment":{
"id{}":[114,124],
"content":"test multi put"
}
}](http://apijson.cn/api?url=http%3A%2F%2Fapijson.cn%3A8080%2Fput&type=JSON&json={"tag"%3A"Comment[]","Comment"%3A{"id{}"%3A[114,124],"content"%3A"test%20multi%20put"}}) | 同以上对应的方法
1.TableName指要查询的数据库表Table的名称字符串。第一个字符为大写字母,剩下的字符要符合英语字母、数字、下划线中的任何一种。对应的值的类型为JSONObject,结构是 {...},里面放的是Table的字段(列名)。下同。
2."tag":tag 后面的tag是非GET、HEAD请求中匹配请求的JSON结构的标识,一般是要查询的Table的名称,由后端Request表中指定。下同。