Skip to content
无闻 edited this page Aug 18, 2015 · 11 revisions

Users

Search users

GET /users/search
Parameters
Name Type Description
q string Required Keyword of username
limit int Limit number of search results, default is 10
Example
$ curl https://try.gogs.io/api/v1/users/search?q=u&limit=5

Request without providing basic authentication or access token will result empty email field for anti-spam purpose.

Response
Status: 200 OK
Content-Type: application/json
{
  "data": [
    {
      "id": 1,
      "username": "unknwon",
      "full_name": "",
      "email": "[email protected]",
      "avatar_url": "/avatars/1"
    },
    {
      "id": 4,
      "username": "user1",
      "full_name": "",
      "email": "[email protected]",
      "avatar_url": "/avatars/4"
    }
  ],
  "ok": true
}

Get a single user

GET /users/:username

Request without providing basic authentication or access token will result empty email field for anti-spam purpose.

Response
Status: 200 OK
Content-Type: application/json
{
  "id": 1,
  "username": "unknwon",
  "full_name": "",
  "email": "[email protected]",
  "avatar_url": "/avatars/1"
}

List access tokens for a user

GET /users/:username/tokens

Request must provide basic authentication.

Response
Status: 200 OK
Content-Type: application/json
[
  {
    "name": "how are you?",
    "sha1": "91e52ff55460eeb247e6423c8ca6e770263cdd8d"
  },
  {
    "name": "hi",
    "sha1": "dd8b56a38a61dc6bb240f2b4fe78ec0eb3fc2a0b"
  }
]
Clone this wiki locally