/doc/api/users.md
Markdown | 622 lines | 480 code | 142 blank | 0 comment | 0 complexity | cce09692a0e527c4bacfad5c9d038534 MD5 | raw file
- # Users
- ## List users
- Get a list of users.
- This function takes pagination parameters `page` and `per_page` to restrict the list of users.
- ### For normal users
- ```
- GET /users
- ```
- ```json
- [
- {
- "id": 1,
- "username": "john_smith",
- "name": "John Smith",
- "state": "active",
- "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
- "web_url": "http://localhost:3000/u/john_smith"
- },
- {
- "id": 2,
- "username": "jack_smith",
- "name": "Jack Smith",
- "state": "blocked",
- "avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
- "web_url": "http://localhost:3000/u/jack_smith"
- }
- ]
- ```
- ### For admins
- ```
- GET /users
- ```
- ```json
- [
- {
- "id": 1,
- "username": "john_smith",
- "email": "john@example.com",
- "name": "John Smith",
- "state": "active",
- "avatar_url": "http://localhost:3000/uploads/user/avatar/1/index.jpg",
- "web_url": "http://localhost:3000/u/john_smith",
- "created_at": "2012-05-23T08:00:58Z",
- "is_admin": false,
- "bio": null,
- "location": null,
- "skype": "",
- "linkedin": "",
- "twitter": "",
- "website_url": "",
- "last_sign_in_at": "2012-06-01T11:41:01Z",
- "confirmed_at": "2012-05-23T09:05:22Z",
- "theme_id": 1,
- "color_scheme_id": 2,
- "projects_limit": 100,
- "current_sign_in_at": "2012-06-02T06:36:55Z",
- "identities": [
- {"provider": "github", "extern_uid": "2435223452345"},
- {"provider": "bitbucket", "extern_uid": "john.smith"},
- {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"}
- ],
- "can_create_group": true,
- "can_create_project": true,
- "two_factor_enabled": true,
- "external": false
- },
- {
- "id": 2,
- "username": "jack_smith",
- "email": "jack@example.com",
- "name": "Jack Smith",
- "state": "blocked",
- "avatar_url": "http://localhost:3000/uploads/user/avatar/2/index.jpg",
- "web_url": "http://localhost:3000/u/jack_smith",
- "created_at": "2012-05-23T08:01:01Z",
- "is_admin": false,
- "bio": null,
- "location": null,
- "skype": "",
- "linkedin": "",
- "twitter": "",
- "website_url": "",
- "last_sign_in_at": null,
- "confirmed_at": "2012-05-30T16:53:06.148Z",
- "theme_id": 1,
- "color_scheme_id": 3,
- "projects_limit": 100,
- "current_sign_in_at": "2014-03-19T17:54:13Z",
- "identities": [],
- "can_create_group": true,
- "can_create_project": true,
- "two_factor_enabled": true,
- "external": false
- }
- ]
- ```
- You can search for users by email or username with: `/users?search=John`
- In addition, you can lookup users by username:
- ```
- GET /users?username=:username
- ```
- For example:
- ```
- GET /users?username=jack_smith
- ```
- ## Single user
- Get a single user.
- ### For user
- ```
- GET /users/:id
- ```
- Parameters:
- - `id` (required) - The ID of a user
- ```json
- {
- "id": 1,
- "username": "john_smith",
- "name": "John Smith",
- "state": "active",
- "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
- "web_url": "http://localhost:3000/u/john_smith",
- "created_at": "2012-05-23T08:00:58Z",
- "is_admin": false,
- "bio": null,
- "location": null,
- "skype": "",
- "linkedin": "",
- "twitter": "",
- "website_url": ""
- }
- ```
- ### For admin
- ```
- GET /users/:id
- ```
- Parameters:
- - `id` (required) - The ID of a user
- ```json
- {
- "id": 1,
- "username": "john_smith",
- "email": "john@example.com",
- "name": "John Smith",
- "state": "active",
- "avatar_url": "http://localhost:3000/uploads/user/avatar/1/index.jpg",
- "web_url": "http://localhost:3000/u/john_smith",
- "created_at": "2012-05-23T08:00:58Z",
- "is_admin": false,
- "bio": null,
- "location": null,
- "skype": "",
- "linkedin": "",
- "twitter": "",
- "website_url": "",
- "last_sign_in_at": "2012-06-01T11:41:01Z",
- "confirmed_at": "2012-05-23T09:05:22Z",
- "theme_id": 1,
- "color_scheme_id": 2,
- "projects_limit": 100,
- "current_sign_in_at": "2012-06-02T06:36:55Z",
- "identities": [
- {"provider": "github", "extern_uid": "2435223452345"},
- {"provider": "bitbucket", "extern_uid": "john.smith"},
- {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"}
- ],
- "can_create_group": true,
- "can_create_project": true,
- "two_factor_enabled": true,
- "external": false
- }
- ```
- ## User creation
- Creates a new user. Note only administrators can create new users.
- ```
- POST /users
- ```
- Parameters:
- - `email` (required) - Email
- - `password` (required) - Password
- - `username` (required) - Username
- - `name` (required) - Name
- - `skype` (optional) - Skype ID
- - `linkedin` (optional) - LinkedIn
- - `twitter` (optional) - Twitter account
- - `website_url` (optional) - Website URL
- - `projects_limit` (optional) - Number of projects user can create
- - `extern_uid` (optional) - External UID
- - `provider` (optional) - External provider name
- - `bio` (optional) - User's biography
- - `location` (optional) - User's location
- - `admin` (optional) - User is admin - true or false (default)
- - `can_create_group` (optional) - User can create groups - true or false
- - `confirm` (optional) - Require confirmation - true (default) or false
- - `external` (optional) - Flags the user as external - true or false(default)
- ## User modification
- Modifies an existing user. Only administrators can change attributes of a user.
- ```
- PUT /users/:id
- ```
- Parameters:
- - `email` - Email
- - `username` - Username
- - `name` - Name
- - `password` - Password
- - `skype` - Skype ID
- - `linkedin` - LinkedIn
- - `twitter` - Twitter account
- - `website_url` - Website URL
- - `projects_limit` - Limit projects each user can create
- - `extern_uid` - External UID
- - `provider` - External provider name