Skip to content
Open
Changes from 1 commit
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
46 changes: 46 additions & 0 deletions users/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ number and email address.
| [GET /users/:userId/badges](#get-usersidbadges) | Returns badges assigned to the user |
| [POST /users](#post-users) | Creates a new User |
| [PATCH /users/self](#patch-usersself) | Updates data of the User |
| [GET /users/filter](#get-usersfilter) | Returns user data based on a filter |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ?filter. (Since filter is not a resource)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In another issue here, /users/userId is being modified to /users?userId=.. .As this change also accepts query parameters directly after /users. Adding query parameters here as well after /users will cause a collision.

can we rename this endpoint to /users/search?....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heyrandhir are we going with /users/filter or /users/search for this API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikhyat187 as of now going with /users/search .also waiting for @ankushdharkar comment on this one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just give the results based on the key provided in the query parameters?

If asked for the filter, we filter and give, if asked for ?userId, we give user details.


## **GET /users**

Expand Down Expand Up @@ -260,3 +261,48 @@ Updates data of the User.
- **Code:** 503
- **Content:**
`{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }`

## **GET /users/filter**

Returns users in the system based on the specified filters.

- **Params**
None
- **Query**
Required: filterParams=[object] (filterParams is an object containing the filter criteria) <br>
Optional:
`levelId=[string]` (an array of level IDs to filter users by) <br>
Optional:
`levelNumber=[number]` (an array of level names to filter users by.) <br>
Optional:
`levelName=[string]` (an array of level names to filter users by.) <br>
Optional:
`tagId=[string]` (an array of tag IDs / Skill Ids to filter users by.) <br>
Optional:
`state=[string]` (an array of user states to filter users by i.e OOO, IDLE, ACTIVE ) <br>
- **Body**
None
- **Headers**
Content-Type: application/json
- **Cookie**
rds-session: `<JWT>`
- **Success Response:**
- **Code:** 200
- **Content:**

```
{
message: 'Users returned successfully!'
users: [
{<user_object>}
]
count: 'number'
}
```

- **Error Response:**
- **Code:** 401
- **Content:**
`{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }`
- **Code:** 500
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'Something went wrong please contact admin.' }`