{
'id': string,
'username': string,
'first_name': string,
'last_name': string,
'email': string,
'phone': number,
'yoe': number,
'company': string,
'designation': string,
'img': string,
'github_id': string,
'linkedin_id': string,
'twitter_id': string,
'instagram_id': string,
'website': string,
'github_display_name': string,
'isMember': boolean,
'userType': string,
'tokens': {},
'badges': []
}
Note:: Only the GET users/self
route will return phone
and email
if
private
query is passed as true. This way we are not exposing users' phone
numbers and email addresses to everyone. Users can only see their own phone
number and email address.
Route | Description |
---|---|
GET /users | Returns all users in the system |
GET /users/self | Returns the logged in user's details |
GET /users/userId/:userId | Returns user with given userId |
GET /users/:username | Returns user with given username |
GET /users/:userId/badges | Returns badges assigned to the user |
POST /users | Creates a new User |
POST /users/discord-sync | Syncs RDS users with Discord members |
PATCH /users/self | Updates data of the User |
Returns all users in the system.
- Params
None - Query
- Optional:
size=[integer]
(size
is number of users requested per page, value ranges in between 1-100, and default value is 100) - Optional:
page=[integer]
(page
can either be 0 or positive-number, and default value is 0) - Optional:
search=[string]
(search
is a string value for username prefix) - Optional:
next=[string]
(next
is id of the DB document to get next batch/page of results after that document.) - Optional:
prev=[string]
(prev
is id of the DB document to get previous batch/page of results before that document.) - Optional:
query=[string]
(query
can be used to filter and/or sort users based on their PR and Issue status within a given date range. Learn more )
- Optional:
- Body
None - Headers
Content-Type: application/json - Cookie
rds-session:<JWT>
- Success Response:
- Code: 200
- Content:
{
message: 'Users returned successfully!'
users: [
{<user_object>}
]
links: {
next: '/users?next={<DB document id>}&size={number}&search={string}',
prev: '/users?prev={<DB document id>}&size={number}&search={string}'
}
}
- Error Response:
- Code: 401
- Content:
{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }
- Content:
- Code: 401
Returns the details of logged in user.
- Params
None - Query private=[boolean] private=[boolean]
- Body
None - Headers
Content-Type: application/json - Cookie
rds-session:<JWT>
- Success Response:
- Code: 200
- Content:
{ <user_object> }
Note: The user object will include
phone
andemail
only when the queryprivate
is passed astrue
for this route. No other route will returnphone
andemail
.
- Content:
- Code: 200
- Error Response:
- Code: 401
- Content:
{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }
- Content:
- Code: 404
- Content:
{ 'statusCode': 404, 'error': 'Not Found', 'message': 'User doesn't exist' }
- Content:
- Code: 500
- Content:
{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }
- Content:
- Code: 401
Returns the specified user.
- Params
Required:userId=[string]
- Body
None - Headers
Content-Type: application/json - Cookie
None - Success Response:
- Code: 200
- Content:
{ 'message': 'User returned successfully!', 'user': <user_object> }
- Content:
- Error Response:
- Code: 404
- Content:
{ error: 'Not Found', message: 'User doesn't exist' }
- Content:
- Code: 500
- Content:
{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'Error while formatting phone and email' }
- Content:
- Code: 503
- Content:
{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }
- Content:
- Code: 404
Returns the specified user.
- Params
Required:username=[string]
- Body
None - Headers
Content-Type: application/json - Cookie
None - Success Response:
- Code: 200
- Content:
{ 'message': 'User returned successfully!', 'user': <user_object> }
- Content:
- Error Response:
- Code: 404
- Content:
{ error: 'Not Found', message: 'User doesn't exist' }
- Content:
- Code: 503
- Content:
{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin"' }
- Content:
- Code: 404
Returns the availability of username.
- Params
Required:username=[string]
- Body
None - Headers
Content-Type: application/json - Cookie
rds-session:<JWT>
- Success Response:
- Code: 200
- Content:
{ 'isUsernameAvailable': <boolean> }
- Content:
- Code: 200
- Error Response:
- Code: 401
- Content:
{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }
- Content:
- Code: 500
- Content:
{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }
- Content:
- Code: 401
Returns badges assigned to the user
- Params
Required:id=[string]
- Query
None - Body
None - Headers
Content-Type: application/json - Cookie
None - Success Response:
- Code: 200
- Content:
{ 'message': 'Badges returned succesfully', 'badges': Array<badge_object> }
- Content:
- Error Response:
- Code: 400
- Content:
{ 'statusCode': 400, 'error': 'Bad Request', 'message': 'Failed to get user badges.' }
- Content:
- Code: 400
Creates a new User.
- Params
None - Query
None - Headers
Content-Type: application/json - Cookie
rds-session:<JWT>
- Body
{ <user_object> }
- Success Response:
- Code: 200
- Content:
{ <user_object> }
- Content:
- Code: 200
- Error Response:
- Code: 409
- Content:
{ "statusCode": 409, "error": "Conflict", "message": "User already exists" }
- Content:
- Code: 401
- Content:
{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }
- Content:
- Code: 409
Sync RDS users with Discord server members using an inDiscord
flag.
- Params
None - Query
None - Headers
Content-Type: application/json - Cookie
rds-session:<JWT>
- Body None
- Success Response:
- Code: 200
- Content:
{ markedTrue : <number>, markedFalse: <number>, unchanged: <number> }
- Content:
- Code: 200
- Error Response:
- Code: 401
- Content:
{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }
- Content:
- Code: 503
- Content:
{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }
- Content:
- Code: 401
Updates data of the User.
- Params
None - Query
None - Headers
Content-Type: application/json - Cookie
rds-session:<JWT>
- Body
{ <user_object> }
- Success Response:
- Code: 204
- Content:
{ 'message': 'User updated successfully!'}
- Content:
- Code: 204
- Error Response:
- Code: 404
- Content:
{ 'statusCode': 404, 'error': 'Not Found', 'message': 'User not found' }
- Content:
- Code: 401
- Content:
{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }
- Content:
- Code: 403
- Content:
{ 'statusCode': 403, 'error': 'Forbidden', 'message': 'Cannot update username again'}
- Content:
- Code: 503
- Content:
{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }
- Content:
- Code: 404