-
-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
The Auth Route provides endpoints for managing auth-related operations.
Endpoint: /auth/login
Method: POST
Description: Logs in a user and returns an authentication token.
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
username | string | Optional | User's username |
string | Optional | User's email | |
password | string | Required | User's password |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "Username is required", "param": "username", "location": "body" }, { "msg": "Email is required", "param": "email", "location": "body" }, { "msg": "Password is required", "param": "password", "location": "body" } ] }
- Response Body:
-
401 Unauthorized
-
Response Body:
{ "error": "Invalid username or password" }
-
Response Body:
{ "error": "Invalid password" }
-
Success Response:
-
200 OK
- Response Body:
{ "token": "string" }
- Response Body:
Endpoint: /auth/logout
Method: POST
Description: Logs out the currently authenticated user.
Error Responses:
-
500 Internal Server Error
- Response Body:
{ "message": "Failed to logout" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "message": "Logout successful" }
- Response Body:
Endpoint: /auth/register
Method: POST
Description: Registers a new user and returns an authentication token.
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
username | string | required | User's username |
string | required | User's email | |
password | string | required | User's password |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "Username is required", "param": "username", "location": "body" }, { "msg": "Email is required", "param": "email", "location": "body" }, { "msg": "Password is required", "param": "password", "location": "body" } ] }
- Response Body:
-
401 Unauthorized
- Response Body:
{ "message": "User already exists based on the data provided" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "token": "string" }
- Response Body:
The Users Route provides endpoints for managing user-related operations.
Endpoint: /users/add/user
Method: POST
Description: Adds a new user to the system.
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
username | string | Required | User's username |
string | Required | User's email | |
password | string | Required | User's password |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "Username is required", "param": "username", "location": "body" }, { "msg": "Email is required", "param": "email", "location": "body" }, { "msg": "Password is required", "param": "password", "location": "body" } ] }
- Response Body:
-
401 Unauthorized
- Response Body:
{ "message": "User already exists based on the data provided" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "userInstance": { "uuid": "string", "username": "string", "ekoTag": "string", "email": "string", "password": "string", "joinedDate": "string", "followedInterests": [], "followers": [], "following": [] } }
- Response Body:
Endpoint: /users/edit/user/:uuid
Method: PUT
Description: Edits an existing user.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | User's UUID |
Request Body:
Include any fields that need to be updated for the user.
Error Responses:
-
404 Not Found
- Response Body:
{ "error": "User not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "updatedUser": { "uuid": "string", "username": "string", "ekoTag": "string", "email": "string", "password": "string", "joinedDate": "string", "followedInterests": [], "followers": [], "following": [] } }
- Response Body:
Endpoint: /users/remove/user/:uuid
Method: DELETE
Description: Removes a user from the system.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | User's UUID |
Error Responses:
-
401 Unauthorized
- Response Body:
{ "error": "Invalid user" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "message": "The user {uuid} has been removed successfully" }
- Response Body:
Endpoint: /users/fetch/user/:uuid
Method: GET
Description: Fetches a user from the system.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | User's UUID |
Error Responses:
-
404 Not Found
- Response Body:
{ "error": "User not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "user": { "uuid": "string", "username": "string", "ekoTag": "string", "email": "string", "password": "string", "joinedDate": "string", "followedInterests": [], "followers": [], "following": [] } }
- Response Body:
Endpoint: /users/fetch/users
Method: GET
Description: Fetches all users from the system.
Error Responses:
-
404 Not Found
- Response Body:
{ "error": "Users not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "users": [ { "uuid": "string", "username": "string", "ekoTag": "string", "email": "string", "password": "string", "joinedDate": "string", "followedInterests": [], "followers": [], "following": [] } ] }
- Response Body:
Endpoint: /users/add/follower
Method: POST
Description: Adds a follower to a user.
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
userUUID | string | Required | User's UUID |
targetUUID | string | Required | Target user's UUID |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "User uuid is required", "param": "userUUID", "location": "body" }, { "msg": "Target uuid is required", "param": "targetUUID", "location": "body" } ] }
- Response Body:
-
404 Not Found
- Response Body:
{ "error": "User not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "message": "The follower {targetUUID} has been added to User {userUUID} successfully" }
- Response Body:
Endpoint: /users/remove/follower
Method: DELETE
Description: Removes a follower from a user.
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
userUUID | string | Required | User's UUID |
targetUUID | string | Required | Target user's UUID |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "User uuid is required", "param": "userUUID", "location": "body" }, { "msg": "Target uuid is required", "param": "targetUUID", "location": "body" } ] }
- Response Body:
-
404 Not Found
- Response Body:
{ "error": "User not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "message": "The follower {targetUUID} has been removed from User {userUUID} successfully" }
- Response Body:
Endpoint: /users/fetch/followers/:uuid
Method: GET
Description: Fetches the followers of a user.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | User's UUID |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "User uuid is required", "param": "uuid", "location": "params" } ] }
- Response Body:
-
404 Not Found
- Response Body:
{ "error": "User not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "followerList": [], "followerCount": 0 }
- Response Body:
Endpoint: /users/fetch/following/:uuid
Method: GET
Description: Fetches the users followed by a user.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | User's UUID |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "User uuid is required", "param": "uuid", "location": "params" } ] }
- Response Body:
-
404 Not Found
- Response Body:
{ "error": "User not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "followingList": [], "followingCount": 0 }
- Response Body:
The Interests Route provides endpoints for managing interest-related operations.
Endpoint: /interests/add/group
Method: POST
Description: Adds a new group to the system.
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
name | string | Required | Group's name |
description | string | Required | Group's description |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "Name is required", "param": "name", "location": "body" }, { "msg": "Description is required", "param": "description", "location": "body" } ] }
- Response Body:
-
401 Unauthorized
- Response Body:
{ "error": "Invalid group" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "groupInstance": { "uuid": "string", "name": "string", "description": "string", "interests": [] } }
- Response Body:
Endpoint: /interests/edit/group/:uuid
Method: PUT
Description: Edits an existing group.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | Group's UUID |
Request Body:
Include any fields that need to be updated for the group.
Error Responses:
-
404 Not Found
- Response Body:
{ "error": "Group not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "updatedGroup": { "uuid": "string", "name": "string", "description": "string", "interests": [] } }
- Response Body:
Endpoint: /interests/remove/group/:uuid
Method: DELETE
Description: Removes a group from the system.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | Group's UUID |
Error Responses:
-
401 Unauthorized
- Response Body:
{ "error": "Invalid group" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "message": "The group {uuid} has been removed successfully" }
- Response Body:
Endpoint: /interests/fetch/group/:uuid
Method: GET
Description: Fetches a group from the system.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | Group's UUID |
Error Responses:
-
404 Not Found
- Response Body:
{ "error": "Group not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "group": { "uuid": "string", "name": "string", "description": "string", "interests": [] } }
- Response Body:
Endpoint: /interests/fetch/groups
Method: GET
Description: Fetches all groups from the system.
Error Responses:
-
404 Not Found
- Response Body:
{ "error": "Groups not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "groups": [ { "uuid": "string", "name": "string", "description": "string", "interests": [] } ] }
- Response Body:
Endpoint: /interests/add/interest
Method: POST
Description: Adds a new interest to the system.
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
name | string | Required | Interest's name |
description | string | Required | Interest's description |
group | string | Required | Interest's group |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "Name is required", "param": "name", "location": "body" }, { "msg": "Description is required", "param": "description", "location": "body" }, { "msg": "Group is required", "param": "group", "location": "body" } ] }
- Response Body:
- 401 Unauthorized
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "interestInstance": { "uuid": "string", "name": "string", "description": "string", "group": "string", "followers": [] } }
- Response Body:
Endpoint: /interests/edit/interest/:uuid
Method: PUT
Description: Edits an existing interest.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | Interest's UUID |
Request Body:
Include any fields that need to be updated for the interest.
Error Responses:
-
404 Not Found
- Response Body:
{ "error": "Interest not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "updatedInterest": { "uuid": "string", "name": "string", "description": "string", "group": "string", "followers": [] } }
- Response Body:
Endpoint: /interests/remove/interest/:uuid
Method: DELETE
Description: Removes an interest from the system.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | Interest's UUID |
Error Responses:
-
401 Unauthorized
- Response Body:
{ "error": "Invalid interest" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "message": "The interest {uuid} has been removed successfully" }
- Response Body:
Endpoint: /interests/fetch/interest/:uuid
Method: GET
Description: Fetches an interest from the system.
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uuid | string | Required | Interest's UUID |
Error Responses:
-
404 Not Found
- Response Body:
{ "error": "Interest not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "interest": { "uuid": "string", "name": "string", "description": "string", "group": "string", "followers": [] } }
- Response Body:
Endpoint: /interests/fetch/interests
Method: GET
Description: Fetches all interests from the system.
Error Responses:
-
404 Not Found
- Response Body:
{ "error": "Interests not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "interests": [ { "uuid": "string", "name": "string", "description": "string", "group": "string", "followers": [] } ] }
- Response Body:
Endpoint: /interests/add/follower
Method: POST
Description: Adds a follower to an interest.
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
interestUUID | string | Required | Interest's UUID |
userUUID | string | Required | User's UUID |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "Interest uuid is required", "param": "interestUUID", "location": "body" }, { "msg": "User uuid is required", "param": "userUUID", "location": "body" } ] }
- Response Body:
-
404 Not Found
- Response Body:
{ "error": "Interest not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "message": "The follower {userUUID} has been added to Interest {interestUUID} successfully" }
- Response Body:
Endpoint: /interests/remove/follower
Method: DELETE
Description: Removes a follower from an interest.
Request Body:
Parameter | Type | Required | Description |
---|---|---|---|
interestUUID | string | Required | Interest's UUID |
userUUID | string | Required | User's UUID |
Error Responses:
-
400 Bad Request
- Response Body:
{ "error": [ { "msg": "Interest uuid is required", "param": "interestUUID", "location": "body" }, { "msg": "User uuid is required", "param": "userUUID", "location": "body" } ] }
- Response Body:
-
404 Not Found
- Response Body:
{ "error": "Interest not found" }
- Response Body:
-
500 Internal Server Error
- Response Body:
{ "error": "Internal Server Error" }
- Response Body:
Success Response:
-
200 OK
- Response Body:
{ "message": "The follower {userUUID} has been removed from Interest {interestUUID} successfully" }
- Response Body:
Found a bug or have a suggestion? Open an issue on GitHub.
For general inquiries, contact us at vladwhiteinbox@outlook.com.
This project is released under the CC-BY-NC-ND-4.0.
© 2023 Vlad White | Ecko Backend Server