API Documentation - FenneAustin/Slack-Clone GitHub Wiki
Slack
API Documentation
All endpoints that require authentication
All endpoints that require a current user to be logged in.
- Request: endpoints that require authentication
- Error Response: Require authentication
-
Status Code: 401
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Authentication required", "statusCode": 401 }
-
All endpoints that require proper authorization
All endpoints that require authentication and the current user does not have the correct role(s) or permission(s).
- Request: endpoints that require proper authorization
- Error Response: Require proper authorization
-
Status Code: 403
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Forbidden", "statusCode": 403 }
-
Get the Current User
Returns the information about the current user that is logged in.
-
Require Authentication: true
-
Request
- Method: get
- URL: /users/Me
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "id": 1, "firstName": "John", "lastName": "Smith", "email": "[email protected]" }
-
Log In a User
Logs in a current user with valid credentials and returns the current user's information.
-
Require Authentication: false
-
Request
-
Method: post
-
URL: /login
-
Headers:
- Content-Type: application/json
-
Body:
{ "email": "[email protected]", "password": "secret password" }
-
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "id": 1, "firstName": "John", "lastName": "Smith", "email": "[email protected]", "token": "" }
-
-
Error Response: Invalid credentials
-
Status Code: 401
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Invalid credentials", "statusCode": 401 }
-
-
Error response: Body validation errors
-
Status Code: 400
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Validation error", "statusCode": 400, "errors": { "email": "Email is required", "password": "Password is required" } }
-
Sign Up a User
Creates a new user, logs them in as the current user, and returns the current user's information.
-
Require Authentication: false
-
Request
-
Method: post
-
URL: /Signup
-
Headers:
- Content-Type: application/json
-
Body:
{ "firstName": "John", "lastName": "Smith", "email": "[email protected]", "password": "secret password" }
-
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "id": 1, "firstName": "John", "lastName": "Smith", "email": "[email protected]", "token": "" }
-
-
Error response: User already exists with the specified email
-
Status Code: 403
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "User already exists", "statusCode": 403, "errors": { "email": "User with that email already exists" } }
-
-
Error response: Body validation errors
-
Status Code: 400
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Validation error", "statusCode": 400, "errors": { "email": "Invalid email", "firstName": "First Name is required", "lastName": "Last Name is required" } }
-
Get all workspaces the current user is in
Returns all the workspaces the current user is associated with
-
Require Authentication: true
-
Request
- Method: get
- URL: /workspaces/me
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
-
Content-Type: application/json
-
Body:
{ "Workspaces": [ { "id": 1, "ownerId": 1, "name": "App Academy", "workspace_image_id": "image url" } ] }
-