device-docking/爱牵挂/爱牵挂M1对外API/community.md
2023-12-20 11:48:09 +08:00

167 lines
5.4 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

如果是post请求把参数带到body里面禁止写到URL后面。URL后面带参数的全是get请求。 我们的测试服虽然get和post请求都可以使用但是要是用规范改post请求的时候必须post请求并且把参数放到body下不要放到URL后面。我们的正式服因为换过架构所以会更加规范修改接口必须是post且放到body下进行请求
社区信息
========
## 查看社区信息
- 地址: /api/community/[community id]
- 方法: GET
- 验证方法: Cookie: user
- 权限要求: superuser/operator角色 或 社区成员
- 响应对象: [Community](object.md#community)
- 请求范例
curl -v -A CURL -b cookies.txt http://127.0.0.1:8000/api/community/54a38233bf483c6ddfec4b79
- 响应范例
```json
{
"obj": {
"_id": {
"$oid": "54a38233bf483c6ddfec4b79"
},
"name": "测试社区",
"email": "test@test.com",
"telephone": "13399999999",
"administrators": [
{
"$oid": "53f722d5bf483c5bd03d0a80"
}
],
"sos_url": "http://test.aiqiangua.com/12349xzOrgan/api/sos/happenSOSAction.do?",
"location_url": "",
"sosdata_url": "",
"heartratedata_url": "",
"pedometerdata_url": "",
"sleepdata_url": "",
"powerdata_url": "",
"falldata_url": "",
"token": "",
"created_at": {
"$date": 1420030643432
},
"$administrators": [
{
"_id": {
"$oid": "53f722d5bf483c5bd03d0a80"
},
"username": "user01",
"password": "d5a99288b270b6c1989975fdb352425913c45e1640b35473ef9370fc",
"email": "user01@abc.com",
"nickname": "管理员",
"phone": "12345612349",
"telephone": "020-183849339",
"app": "aiqiangua2.0",
"devicetokens": [],
"weight": 65,
"step": 60,
"age": 50,
"height": 175,
"avatar": "user01.tmp",
"avatar_url": "/media/avatar/200/user01.jpg",
"community": {
"$oid": "54a38233bf483c6ddfec4b79"
},
"role": "user",
"gender": "male",
"address": "广州",
"created_at": {
"$date": 1408734037917
},
"updated_at": {
"$date": 1408734037913
},
"lastlogin_ip": "183.61.80.249",
"lastlogin_at": {
"$date": 1473846870019
},
"lastlogin_by": "Java/1.6.0_25",
"enable": true,
"email_is_checked": false,
"phone_is_checked": false,
"push_sos_enable": false,
"push_fence_enable": false,
"push_abnormal_enable": false,
"push_message_enable": false,
"push_lowpower_enable": false,
"push_system_enable": false,
"push_fall_enable": true,
"push_env_enable": true,
"auth_updated_at": {
"$date": 1473846882861
},
"is_device_owner": false,
"devices": [
"868219000223161"
],
"groups": [
{
"$oid": "579e0267264251061974b349"
}
]
}
]
},
"success": true,
"obj_name": "community"
}
```
# 查看社区内所有设备设备号,昵称,在线状态、地址以及位置点
- 地址: /api/community/community id/devicesloc/
- 方法: GET
- 验证方法: Cookie: user
- 响应对象: 返回单个对象,如果对应的数据项有数据,则返回数据对象;如果没有则返回'{}'
- 权限要求: superuser/operator角色 或 社区成员
- 响应对象: [Community](object.md#community)
- URL参数: device oid
- 请求参数:
| 名称 | 必须 | 类型 | 说明 |
| --------------- | ---- | ------------ | ------------------------------ |
| cid | 是 | string | 机构id |
- 请求范例:
curl -v -A CURL -b cookies.txt http://127.0.0.1:8888/api/community/59718dfa264251292a48b5c2/devicesloc/
> GET /api/community/59718dfa264251292a48b5c2/devicesloc/ HTTP/1.1
> User-Agent: CURL
> Host: 127.0.0.1:8888
> Accept: */*
> Cookie: ""2|1:0|10:1502846059|4:user|8:YWRtaW4y|f92dad6929734b005ea153a4585f3c02ea9f7a70432a0410518df8a108030f7d""
- 响应范例:
```json
{
"objs": [
{
"point": {
"type": "Point",
"coordinates": [
113.4560004,
23.1663146
]
},
"online": true,
"date": {
"$date": 1502901949303
},
"address": "广东省 广州市 黄埔区 育星路 靠近广州科学城创新大厦C2",
"imei": "869426020070147",
"nickname": "二踢脚"
}
],
"page": "",
"success": true,
"obj_name": "devices_location"
}
```