Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document new Field parameter of Users Search API call #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ If you have any questions or concern, please [file an issue](https://github.com/
- [Releases](Repositories/Releases.md)
- [Webhooks](Repositories/Webhooks.md)
- [Users](Users)
- [Search](Users/Search.md)
- [Emails](Users/Emails.md)
- [Followers](Users/Followers.md)
- [Public Keys](Users/Public%20Keys.md)
Expand Down
48 changes: 0 additions & 48 deletions Users/README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,5 @@
# Users

## Search users

```
GET /users/search
```

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

### 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
```

### Response

```
Status: 200 OK
```
```json
{
"data": [
{
"id": 1,
"username": "unknwon",
"full_name": "",
"email": "fake@local",
"avatar_url": "/avatars/1"
},
{
"id": 4,
"username": "user1",
"full_name": "",
"email": "[email protected]",
"avatar_url": "/avatars/4"
}
],
"ok": true
}
```

## Get a single user

```
Expand Down
48 changes: 48 additions & 0 deletions Users/Search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Search users

```
GET /users/search
```

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

### Parameters

|Name|Type|Description|
|----|----|-----------|
|q|string|**Required** Keyword of username|
|field|string|What field to search on. Only allows `name` (default) and `email`|
|limit|int|Limit number of search results. Default is **10**|

### Example

```
$ curl https://try.gogs.io/api/v1/users/search?q=u&limit=5
```

### Response

```
Status: 200 OK
```
```json
{
"data": [
{
"id": 1,
"username": "unknwon",
"full_name": "",
"email": "fake@local",
"avatar_url": "/avatars/1"
},
{
"id": 4,
"username": "user1",
"full_name": "",
"email": "[email protected]",
"avatar_url": "/avatars/4"
}
],
"ok": true
}
```