# 拉取 KV 接口
# 接口 URL
测试环境 https://test.creativity.qq.com:9311/kv/get
# 接口 GET 参数(必填)
appid:MOGS分配的appid
app_plat:平台类型, 1.微信 2.QQ 3.PC,目前仅支持微信,填 1
openid:用户openid
js_code: 自定义登陆态
# 接口字段说明 (POST 数据)
# 请求描述
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
key_list | string 数组 | 是 | 拉取的 key 数组 |
# 请求返回描述
参数 | 类型 | 描述 |
---|---|---|
ret | int | 返回值 (0-成功 其他-失败) |
info_list | KVInfo 数组 | KVInfo 数组 |
KVInfo 结构
字段名 | 类型 | 描述 |
---|---|---|
key | string | key |
value_int | int64 | key 的 int 值 |
value_str | string | key 的 string 值 最长支持 512 字节 |
value_long_str | string | key 的长 string 值 最长支持 65536 字节 |
# 调用示例
curl -X POST -d '{"keys": ["key1", "key2"]}' 'https://test.creativity.qq.com:9311/kv/get?appid=10000&app_plat=1&openid=opvxI4y_cVJx2pxsFCQrJ4FZB5gk&js_code=xxx'
1
# 更新 KV 接口
# 接口 URL
测试环境 https://test.creativity.qq.com:9311/kv/update
# 接口GET参数(必填)
appid:MOGS分配的appid
app_plat:平台类型, 1.微信 2.QQ 3.PC,目前仅支持微信,填 1
openid:用户openid
js_code: 自定义登陆态
# 接口字段说明 (POST数据)
# 请求描述
参数 | 类型 | 是否必填 | 描述 |
---|---|---|---|
key | string | 是 | 待更新的 key |
update_value_list | int 数组 | 是 | 更新的value类型数组,1 表示更新 value_int,2 表示更新 value_str,3 表示更新 value_long_str |
value_int | int64 | 是 | 待更新的 int 值,如果 update_value_list 中填了 1 |
value_str | string | 是 | 待更新的 string 值 最长支持 512 字节,如果 update_value_list 中填了 2 |
value_long_str | string | 是 | 待更新长 string 值 最长支持 65536 字节,如果 update_value_list 中填了 3 |
# 请求返回描述
参数 | 类型 | 描述 |
---|---|---|
ret | int | 返回值 (0-成功 其他-失败) |
# 调用示例
// 更新 key1 的 value_int 和 value_str 字段,update_value_list 需要填 1 和 2
curl -X POST -d '{"key": "key1", "update_value_list": [1, 2], "value_int": 10, "value_str": "hello"}' 'https://test.creativity.qq.com:9311/kv/update?appid=10000&app_plat=1&openid=opvxI4y_cVJx2pxsFCQrJ4FZB5gk&js_code=xxx'
// 拉取下 看看回包
curl -X POST -d '{"keys": ["key1", "key2"]}' 'https://test.creativity.qq.com:9311/kv/get?appid=10000&app_plat=1&openid=opvxI4y_cVJx2pxsFCQrJ4FZB5gk&js_code=xxx'{"infoList":[{"key":"key1","valueInt":"10","valueLongStr":"","valueStr":"hello"},{"key":"key2"}]}
// 更新 key1 的 value_long_str 字段,update_value_list 需要填 3
curl -X POST -d '{"key": "key1", "update_value_list": [3], "value_long_str": "hello world"}' 'https://test.creativity.qq.com:9311/kv/update?appid=10000&app_plat=1&openid=opvxI4y_cVJx2pxsFCQrJ4FZB5gk&js_code=xxx'
// 拉取下 看看回包
curl -X POST -d '{"keys": ["key1", "key2"]}' 'https://test.creativity.qq.com:9311/kv/get?appid=10000&app_plat=1&openid=opvxI4y_cVJx2pxsFCQrJ4FZB5gk&js_code=xxx'{"infoList":[{"key":"key1","valueInt":"10","valueLongStr":"hello world","valueStr":"hello"},{"key":"key2"}]}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11