用户关系
在 Mixin Messenger 当中,用户可以添加另一位 Messenger,或者机器人为好友,或者拉黑另一位 Messenger 或 机器人用户。这些 API 主要就是用来管理用户的联系人相关信息。
POST /relationships
该 API 用来管理用户的关系,包括:
- 添加联系人
- 更新联系人信息
- 删除联系人
- 拉黑另一名用户
- 取消拉黑另一名用户
API 端点 URL
https://api.mixin.one/relationships
According to different payload, the API have different behaviors.
Add a Friend and set an alias
请求体
{
"user_id": "user's user_id"
"full_name": "the alias of the friend, optinal."
"action": "ADD"
}
Delete a Friend
请求体
{
"user_id": "user's user_id"
"action": "REMOVE"
}
Block a User
请求体
{
"user_id": "user's user_id"
"action": "BLOCK"
}
Unblock a User
请求体
{
"user_id": "user's user_id"
"action": "UNBLOCK"
}
请求示例
curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/relationships --data REQUEST_BODY
Response
{
"data":{
"type": "user",
"user_id": "773e5e77-4107-45c2-b648-8fc722ed77f5",
"identity_number": "7000",
"phone": "+8613801380138",
"full_name": "Team Mixin",
"biography": "",
"avatar_url": "https://images.mixin.one/E2y0BnTopFK9qey0YI-8xV3M82kudNnTaGw0U5SU065864SsewNUo6fe9kDF1HIzVYhXqzws4lBZnLj1lPsjk-0=s256",
"relationship": "STRANGER",
"mute_until": "0001-01-01T00:00:00Z",
"created_at": "2017-12-23T18:23:26.996149Z",
"is_verified": true,
"is_scam": false,
"session_id": "a34c07a9-755d-4b54-94c5-e45e9a2dd43e",
"pin_token_base64": "",
"code_id": "dabcf1c2-6a5e-4ea3-ad51-6e6641a06c7c",
"code_url": "https://mixin.one/codes/dabcf1c2-6a5e-4ea3-ad51-6e6641a06c7c",
"has_pin": true,
"device_status": "ACTIVE",
"has_emergency_contact": true,
"receive_message_source": "CONTACTS",
"accept_conversation_source": "CONTACTS",
"accept_search_source": "CONTACTS",
"fiat_currency": "USD",
"transfer_notification_threshold": 0,
"transfer_confirmation_threshold": 0,
}
}
GET /blocking_users
Get blocked users.
API 端点 URL
https://api.mixin.one/blocking_users
请求示例
curl -i -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/blocking_users
Response
{
"data":{
"type": "user",
"user_id": "773e5e77-4107-45c2-b648-8fc722ed77f5",
"identity_number": "7000",
"phone": "+8613801380138",
"full_name": "Team Mixin",
"biography": "",
"avatar_url": "https://images.mixin.one/E2y0BnTopFK9qey0YI-8xV3M82kudNnTaGw0U5SU065864SsewNUo6fe9kDF1HIzVYhXqzws4lBZnLj1lPsjk-0=s256",
"relationship": "STRANGER",
"mute_until": "0001-01-01T00:00:00Z",
"created_at": "2017-12-23T18:23:26.996149Z",
"is_verified": true,
"is_scam": false,
"session_id": "a34c07a9-755d-4b54-94c5-e45e9a2dd43e",
"pin_token_base64": "",
"code_id": "dabcf1c2-6a5e-4ea3-ad51-6e6641a06c7c",
"code_url": "https://mixin.one/codes/dabcf1c2-6a5e-4ea3-ad51-6e6641a06c7c",
"has_pin": true,
"device_status": "ACTIVE",
"has_emergency_contact": true,
"receive_message_source": "CONTACTS",
"accept_conversation_source": "CONTACTS",
"accept_search_source": "CONTACTS",
"fiat_currency": "USD",
"transfer_notification_threshold": 0,
"transfer_confirmation_threshold": 0,
}
}