{{< details >}}
- Tier: 基础版, 专业版, 旗舰版
- Offering: JihuLab.com, 私有化部署
{{< /details >}}
使用此 API 来执行用户账户的关注操作。有关更多信息,请参阅 关注用户。
关注用户
关注指定用户账户。
POST /users/:id/follow
支持的属性:
属性 | 类型 | 必需 | 描述 |
---|---|---|---|
id |
integer | yes | 用户账户的 ID |
示例请求:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/users/3/follow"
示例响应:
{
"id": 1,
"username": "john_smith",
"name": "John Smith",
"state": "active",
"locked": false,
"avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
"web_url": "http://localhost:3000/john_smith"
}
取消关注用户
取消关注指定用户账户。
POST /users/:id/unfollow
支持的属性:
属性 | 类型 | 必需 | 描述 |
---|---|---|---|
id |
integer | yes | 用户账户的 ID |
示例请求:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/users/3/unfollow"
列出关注某用户的所有账户
列出关注指定用户的所有用户账户。
GET /users/:id/followers
支持的属性:
属性 | 类型 | 必需 | 描述 |
---|---|---|---|
id |
integer | yes | 用户账户的 ID |
示例请求:
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/users/3/followers"
示例响应:
[
{
"id": 2,
"name": "Lennie Donnelly",
"username": "evette.kilback",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/7955171a55ac4997ed81e5976287890a?s=80&d=identicon",
"web_url": "http://127.0.0.1:3000/evette.kilback"
},
{
"id": 4,
"name": "Serena Bradtke",
"username": "cammy",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/a2daad869a7b60d3090b7b9bef4baf57?s=80&d=identicon",
"web_url": "http://127.0.0.1:3000/cammy"
}
]
列出某用户关注的所有账户
列出某个用户关注的所有用户账户。
GET /users/:id/following
支持的属性:
属性 | 类型 | 必需 | 描述 |
---|---|---|---|
id |
integer | yes | 用户账户的 ID |
示例请求:
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/users/3/following"