Skip to content

Commit c381313

Browse files
authored
DOC: Added an API contract for PATCH /users/:userId Endpoint (#211)
* updated doc for userId PATCH endpoint * updated doc for return res fix
1 parent 1a5bf1d commit c381313

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

users/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,3 +582,51 @@ Creating a User Intro in DB if not available
582582
"message": "An internal server error occurred"
583583
}
584584
```
585+
586+
## **PATCH /users/:userId**
587+
588+
Allow SuperUser to approve the profilediff and Authenticated user to update their profile data.
589+
590+
- **Params**
591+
- Optional: `userId=<userId>`
592+
- **Query**
593+
- Optional: `profile=["true"]` (if profile is set to true, it will allow Authenticated user to update the profile data.)
594+
595+
- **Headers**
596+
Content-Type: application/json
597+
- **Cookie**
598+
- rds-session: `<JWT>`
599+
- rds-session: `<SUPERUSER JWT>`
600+
- **Body**
601+
- `{ <user_object> }`
602+
- ```
603+
{
604+
id: `<profileDiffsId>,
605+
message: string
606+
}
607+
```
608+
609+
- **Success Response:**
610+
- **Code:** 204
611+
- **Content:** `{ 'message': 'User updated successfully!'}`
612+
- **Code:** 200
613+
- **Content** `{ message: "Privilege modified successfully!" , disabled_roles: string[] }`
614+
- **Content** `{ message: "Updated user's data successfully!" }`
615+
616+
- **Error Response:**
617+
- **Code:** 404
618+
- **Content:**
619+
`{ 'statusCode': 404, 'error': 'Not Found', 'message': 'User not found' }`
620+
- **Code:** 400
621+
- **Content:**
622+
`{ 'statusCode': 400, 'error': 'Bad Request', 'message': 'Invalid Request.'}`
623+
- **Code:** 401
624+
- **Content:**
625+
`{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User'}`
626+
- **Code:** 403
627+
- **Content:**
628+
`{ 'statusCode': 403, 'error': 'Forbidden', 'message': 'Cannot update username again'}`
629+
`{ 'statusCode': 403, 'error': 'Forbidden', 'message': 'Developers can only update disabled_roles. Use profile service for updating other attributes.'}`
630+
- **Code:** 503
631+
- **Content:**
632+
`{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }`

0 commit comments

Comments
 (0)