-
Notifications
You must be signed in to change notification settings - Fork 1
Documented API
kaanyolcu22 edited this page May 19, 2024
·
1 revision
Endpoint: /signup/
Method: POST
Description:
Registers a new user.
Request Body:
{
"username": "string",
"password": "string",
"email": "string",
"phone_number": "string",
"bio": "string"
}
Response:
201 Created:
Successful registration.
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string"
}
400 Bad Request:
Invalid data.
{
"error": "object"
}
Login
Endpoint: /login/
Method: POST
Description:
Authenticates a user and returns a token.
Request Body:
json
Copy code
{
"username": "string",
"password": "string"
}
Response:
200 OK:
Successful login.
json
Copy code
{
"token": "string",
"user_id": "integer",
"username": "string",
"profile_image": "string"
}
401 Unauthorized:
Invalid credentials.
json
Copy code
{
"error": "Invalid Credentials"
}
Search
Endpoint: /search/
Method: POST
Description:
Searches for entities based on a query.
Request Body:
json
Copy code
{
"query": "string"
}
Response:
200 OK:
Successful search.
json
Copy code
{
"style": [{"name": "string", "image": "string", "entity_id": "integer"}],
"architect": [{"name": "string", "image": "string", "entity_id": "integer"}],
"building": [{"name": "string", "image": "string", "entity_id": "integer"}]
}
204 No Content:
Query missing.
json
Copy code
{
"message": "there was an error with the query."
}
Update User Profile
Endpoint: /update_user_profile/
Method: POST
Description:
Updates the profile of an authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"email": "string",
"profile_image": "string"
}
Response:
200 OK:
Profile updated.
json
Copy code
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string"
}
400 Bad Request:
Invalid data.
json
Copy code
{
"errors": "object"
}
User Profile
Endpoint: /user_profile/
Method: POST
Description:
Fetches the profile and related posts of a user.
Request Body:
json
Copy code
{
"username": "string"
}
Response:
200 OK:
Profile data.
json
Copy code
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string",
"posts": "array",
"bookmarked_posts": "array",
"commented_posts": "array",
"liked_posts": "array"
}
404 Not Found:
User not found.
json
Copy code
{
"detail": "Not found."
}
Authenticated User Profile
Endpoint: /auth_user_profile/
Method: POST
Description:
Fetches the profile and related posts of a user, with additional info for the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"username": "string"
}
Response:
200 OK:
Profile data with follow status.
json
Copy code
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string",
"is_following": "boolean",
"posts": "array",
"bookmarked_posts": "array",
"commented_posts": "array",
"liked_posts": "array"
}
404 Not Found:
User not found.
json
Copy code
{
"detail": "Not found."
}
Create Post
Endpoint: /create_post/
Method: POST
Description:
Creates a new post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"title": "string",
"text": "string",
"image_url": "string",
"entity_id": "integer"
}
Response:
201 Created:
Post created.
json
Copy code
{
"message": "Post created successfully."
}
400 Bad Request:
Missing required fields.
json
Copy code
{
"error": "Title and text are required fields."
}
500 Internal Server Error:
Error occurred.
json
Copy code
{
"error": "string"
}
Like Post
Endpoint: /like_post/
Method: POST
Description:
Likes a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer"
}
Response:
201 Created:
Post liked.
json
Copy code
{
"message": "Post liked successfully."
}
400 Bad Request:
Post ID missing or already liked.
json
Copy code
{
"error": "Post ID is required."
}
json
Copy code
{
"error": "You have already liked this post."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Unlike Post
Endpoint: /get_like_back/
Method: POST
Description:
Removes a like from a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer"
}
Response:
200 OK:
Like removed.
json
Copy code
{
"message": "Like removed successfully."
}
400 Bad Request:
Post ID missing or not liked.
json
Copy code
{
"error": "Post ID is required."
}
json
Copy code
{
"error": "You have not liked this post."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Comment on Post
Endpoint: /comment_post/
Method: POST
Description:
Adds a comment to a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer",
"comment_text": "string"
}
Response:
201 Created:
Comment added.
json
Copy code
{
"message": "Comment added successfully."
}
400 Bad Request:
Post ID or comment text missing.
json
Copy code
{
"error": "Post ID and comment text are required."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Bookmark Post
Endpoint: /bookmark_post/
Method: POST
Description:
Bookmarks a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer"
}
Response:
201 Created:
Post bookmarked.
json
Copy code
{
"message": "Post bookmarked successfully."
}
400 Bad Request:
Post ID missing or already bookmarked.
json
Copy code
{
"error": "Post ID is required."
}
json
Copy code
{
"error": "You have already bookmarked this post."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Unbookmark Post
Endpoint: /unbookmark_post/
Method: POST
Description:
Removes a bookmark from a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer"
}
Response:
200 OK:
Bookmark removed.
json
Copy code
{
"message": "Bookmark removed successfully."
}
400 Bad Request:
write all of them in hack.md format
ChatGPT
markdown
Copy code
# API Documentation
## Signup
**Endpoint:** `/signup/`
**Method:** `POST`
**Description:**
Registers a new user.
**Request Body:**
```json
{
"username": "string",
"password": "string",
"email": "string"
}
Response:
201 Created:
Successful registration.
json
Copy code
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string"
}
400 Bad Request:
Invalid data.
json
Copy code
{
"errors": "object"
}
Login
Endpoint: /login/
Method: POST
Description:
Authenticates a user and returns a token.
Request Body:
json
Copy code
{
"username": "string",
"password": "string"
}
Response:
200 OK:
Successful login.
json
Copy code
{
"token": "string",
"user_id": "integer",
"username": "string",
"profile_image": "string"
}
401 Unauthorized:
Invalid credentials.
json
Copy code
{
"error": "Invalid
no stop all of them should be in copyable
ChatGPT
markdown
Copy code
# API Documentation
## Signup
**Endpoint:** `/signup/`
**Method:** `POST`
**Description:**
Registers a new user.
**Request Body:**
```json
{
"username": "string",
"password": "string",
"email": "string"
}
Response:
201 Created:
Successful registration.
json
Copy code
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string"
}
400 Bad Request:
Invalid data.
json
Copy code
{
"errors": "object"
}
Login
Endpoint: /login/
Method: POST
Description:
Authenticates a user and returns a token.
Request Body:
json
Copy code
{
"
write everyting in one hackmd format, including codes, json etc.
ChatGPT
markdown
Copy code
# API Documentation
## Signup
**Endpoint:** `/signup/`
**Method:** `POST`
**Description:**
Registers a new user.
**Request Body:**
{
"username": "string",
"password": "string",
"email": "string"
}
Response:
201 Created:
Successful registration.
json
Copy code
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string"
}
400 Bad Request:
Invalid data.
json
Copy code
{
"errors": "object"
}
Login
Endpoint: /login/
Method: POST
Description:
Authenticates a user and returns a token.
Request Body:
json
Copy code
{
"username": "string",
"password": "string"
}
Response:
200 OK:
Successful login.
json
Copy code
{
"token": "string",
"user_id": "integer",
"username": "string",
"profile_image": "string"
}
401 Unauthorized:
Invalid credentials.
json
Copy code
{
"error": "Invalid Credentials"
}
Search
Endpoint: /search/
Method: POST
Description:
Searches for entities based on a query.
Request Body:
json
Copy code
{
"query": "string"
}
Response:
200 OK:
Successful search.
json
Copy code
{
"style": [{"name": "string", "image": "string", "entity_id": "integer"}],
"architect": [{"name": "string", "image": "string", "entity_id": "integer"}],
"building": [{"name": "string", "image": "string", "entity_id": "integer"}]
}
204 No Content:
Query missing.
json
Copy code
{
"message": "there was an error with the query."
}
Update User Profile
Endpoint: /update_user_profile/
Method: POST
Description:
Updates the profile of an authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"email": "string",
"profile_image": "string"
}
Response:
200 OK:
Profile updated.
json
Copy code
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string"
}
400 Bad Request:
Invalid data.
json
Copy code
{
"errors": "object"
}
User Profile
Endpoint: /user_profile/
Method: POST
Description:
Fetches the profile and related posts of a user.
Request Body:
json
Copy code
{
"username": "string"
}
Response:
200 OK:
Profile data.
json
Copy code
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string",
"posts": "array",
"bookmarked_posts": "array",
"commented_posts": "array",
"liked_posts": "array"
}
404 Not Found:
User not found.
json
Copy code
{
"detail": "Not found."
}
Authenticated User Profile
Endpoint: /auth_user_profile/
Method: POST
Description:
Fetches the profile and related posts of a user, with additional info for the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"username": "string"
}
Response:
200 OK:
Profile data with follow status.
json
Copy code
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string",
"is_following": "boolean",
"posts": "array",
"bookmarked_posts": "array",
"commented_posts": "array",
"liked_posts": "array"
}
404 Not Found:
User not found.
json
Copy code
{
"detail": "Not found."
}
Create Post
Endpoint: /create_post/
Method: POST
Description:
Creates a new post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"title": "string",
"text": "string",
"image_url": "string",
"entity_id": "integer"
}
Response:
201 Created:
Post created.
json
Copy code
{
"message": "Post created successfully."
}
400 Bad Request:
Missing required fields.
json
Copy code
{
"error": "Title and text are required fields."
}
500 Internal Server Error:
Error occurred.
json
Copy code
{
"error": "string"
}
Like Post
Endpoint: /like_post/
Method: POST
Description:
Likes a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer"
}
Response:
201 Created:
Post liked.
json
Copy code
{
"message": "Post liked successfully."
}
400 Bad Request:
Post ID missing or already liked.
json
Copy code
{
"error": "Post ID is required."
}
json
Copy code
{
"error": "You have already liked this post."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Unlike Post
Endpoint: /get_like_back/
Method: POST
Description:
Removes a like from a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer"
}
Response:
200 OK:
Like removed.
json
Copy code
{
"message": "Like removed successfully."
}
400 Bad Request:
Post ID missing or not liked.
json
Copy code
{
"error": "Post ID is required."
}
json
Copy code
{
"error": "You have not liked this post."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Comment on Post
Endpoint: /comment_post/
Method: POST
Description:
Adds a comment to a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer",
"comment_text": "string"
}
Response:
201 Created:
Comment added.
json
Copy code
{
"message": "Comment added successfully."
}
400 Bad Request:
Post ID or comment text missing.
json
Copy code
{
"error": "Post ID and comment text are required."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Bookmark Post
Endpoint: /bookmark_post/
Method: POST
Description:
Bookmarks a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer"
}
Response:
201 Created:
Post bookmarked.
json
Copy code
{
"message": "Post bookmarked successfully."
}
400 Bad Request:
Post ID missing or already bookmarked.
json
Copy code
{
"error": "Post ID is required."
}
json
Copy code
{
"error": "You have already bookmarked this post."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Unbookmark Post
Endpoint: /unbookmark_post/
Method: POST
Description:
Removes a bookmark from a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer"
}
Response:
200 OK:
Bookmark removed.
json
Copy code
{
"message": "Bookmark removed successfully."
}
400 Bad Request:
Post ID missing.
json
Copy code
{
"error": "Post ID is required."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Follow User
Endpoint: /follow_user/
Method: POST
Description:
Follows a user by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"username": "string"
}
Response:
201 Created:
User followed.
json
Copy code
{
"message": "You are now following {username}."
}
400 Bad Request:
Username missing or following self.
json
Copy code
{
"error": "Username is missing in the request body."
}
json
Copy code
{
"error": "You cannot follow yourself."
}
404 Not Found:
User not found.
json
Copy code
{
"error": "User does not exist."
}
Unfollow User
Endpoint: /unfollow_user/
Method: POST
Description:
Unfollows a user by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"username": "string"
}
Response:
200 OK:
User unfollowed.
json
Copy code
{
"message": "You have unfollowed {username}."
}
400 Bad Request:
Username missing or not following.
json
Copy code
{
"error": "Username is missing in the request body."
}
json
Copy code
{
"error": "You are not following {username}."
}
404 Not Found:
User not found.
json
Copy code
{
"error": "User does not exist."
}
List Followers
Endpoint: /list_followers/
Method: POST
Description:
Lists followers of a user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"username": "string"
}
Response:
200 OK:
List of followers.
json
Copy code
{
"followers": [{"username": "string"}]
}
400 Bad Request:
Username missing.
json
Copy code
{
"error": "Username is missing in the request body."
}
404 Not Found:
User not found.
json
Copy code
{
"error": "User does not exist."
}
List Following
Endpoint: /list_following/
Method: POST
Description:
Lists users followed by a user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"username": "string"
}
Response:
200 OK:
List of followed users.
json
Copy code
{
"following": [{"username": "string"}]
}
400 Bad Request:
Username missing.
json
Copy code
{
"error": "Username is missing in the request body."
}
404 Not Found:
User not found.
json
Copy code
{
"error": "User does not exist."
}
Guest Feed
Endpoint: /guest_feed/
Method: GET
Description:
Fetches latest posts for guest users.
Response:
200 OK:
List of post IDs.
json
Copy code
{
"post_ids": ["integer"]
}
500 Internal Server Error:
Error occurred.
json
Copy code
{
"error": "string"
}
Authenticated Feed
Endpoint: /auth_feed/
Method: GET
Description:
Fetches posts from followed users for authenticated users.
Request Headers:
Authorization: Token <token>
Response:
200 OK:
List of post IDs.
json
Copy code
{
"post_ids": ["integer"]
}
500 Internal Server Error:
Error occurred.
json
Copy code
{
"error": "string"
}
Get Posts by IDs
Endpoint: /get_posts_by_ids/
Method: POST
Description:
Fetches post details by post ID.
Request Body:
json
Copy code
{
"post_id": "integer"
}
Response:
200 OK:
Post details.
json
Copy code
{
"id": "integer",
"title": "string",
"text": "string",
"author": "object",
"created_at": "datetime",
"updated_at": "datetime",
"image": "string",
"likes_count": "integer"
}
400 Bad Request:
Post ID missing.
json
Copy code
{
"error": "Post ID is required."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Building View
Endpoint: /building_view/
Method: POST
Description:
Fetches building information by entity ID.
Request Body:
json
Copy code
{
"entity_id": "integer"
}
Response:
200 OK:
Building details.
json
Copy code
{
"entity_id": "integer",
"name": "string",
"description": "string",
"image": "string"
}
Architect View
Endpoint: /architect_view/
Method: POST
Description:
Fetches architect information by entity ID.
Request Body:
json
Copy code
{
"entity_id": "integer"
}
Response:
200 OK:
Architect details.
json
Copy code
{
"entity_id": "integer",
"name": "string",
"description": "string",
"image": "string"
}
Style View
Endpoint: /style_view/
Method: POST
Description:
Fetches style information by entity ID.
Request Body:
json
Copy code
{
"entity_id": "integer"
}
Response:
200 OK:
Style details.
json
Copy code
{
"entity_id": "integer",
"name": "string",
"description": "string",
"image": "string"
}
Delete Post
Endpoint: /delete_post/
Method: DELETE
Description:
Deletes a post by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"post_id": "integer"
}
Response:
200 OK:
Post deleted.
json
Copy code
{
"message": "Post deleted successfully."
}
400 Bad Request:
Post ID missing.
json
Copy code
{
"error": "Post ID is required."
}
403 Forbidden:
Unauthorized action.
json
Copy code
{
"error": "You do not have permission to delete this post."
}
404 Not Found:
Post not found.
json
Copy code
{
"error": "Post does not exist."
}
Delete Comment
Endpoint: /delete_comment/
Method: DELETE
Description:
Deletes a comment by the authenticated user.
Request Headers:
Authorization: Token <token>
Request Body:
json
Copy code
{
"comment_id": "integer"
}
Response:
200 OK:
Comment deleted.
json
Copy code
{
"message": "Comment deleted successfully."
}
400 Bad Request:
Comment ID missing.
json
Copy code
{
"error": "Comment ID is required."
}
403 Forbidden:
Unauthorized action.
json
Copy code
{
"error": "You do not have permission to delete this comment."
}
404 Not Found:
Comment not found.
json
Copy code
{
"error": "Comment does not exist."
}
Get Entity Posts
Endpoint: /get_entity_posts/
Method: GET
Description:
Fetches posts related to an entity by entity ID.
Request Body:
json
Copy code
{
"entity_id": "integer"
}
Response:
200 OK:
List of posts.
json
Copy code
{
"posts": "array"
}
400 Bad Request:
Entity ID missing.
json
Copy code
{
"error": "Entity ID is required."
}
404 Not Found:
Entity not found.
json
Copy code
{
"error": "Entity does not exist."
}
Basic User Info
Endpoint: /basic_user_info/
Method: POST
Description:
Fetches basic user information by username.
Request Body:
json
Copy code
{
"username": "string"
}
Response:
200 OK:
User data.
json
Copy code
{
"id": "integer",
"username": "string",
"email": "string",
"profile_image": "string"
}
404 Not Found:
User not found.
json
Copy code
{
"detail": "Not found."
}
Entity from Search Result
Endpoint: /entity_from_searchresult/
Method: POST
Description:
Fetches entity information from search result ID.
Request Body:
json
Copy code
{
"id": "integer"
}
Response:
200 OK:
Entity details.
json
Copy code
{
"entity_id": "integer",
"name": "string",
"category": "string"
}
404 Not Found:
Search result not found.
json
Copy code
{
"detail": "Not found."
}
🏠 Home
- Oktay Özel
- Aras Taşçı
- Yunus Emre Özdemir
- Kaan Yolcu
- Elif Nur Deniz
Eymen Çeliktürk- Anıl Köse
Battal Hazar- Halil Özkan
Ebru Özçakı- Ali Tarık Şahin
- Ahmet Oğuz Engin
- Yağız Güldal
- Lab Report 1
- Lab Report 2
- Lab Report 3
- Lab Report 4
- Lab Report 5
- Lab Report 6
- Lab 7 PR
- Lab 8 PR
- Lab Report 9
- Lab Meeting 1
- Weekly Meeting 1
- Lab Meeting 2
- Weekly Meeting 2
- Frontend Meeting 1
- Lab Meeting 3
- Weekly Meeting 3
- Lab Meeting 4
- Frontend Meeting 2
- Weekly Meeting 4
- Weekly Meeting 5
- Frontend Meeting 3
- Lab Meeting 5
- Weekly Meeting 6
- Weekly Meeting 7
- Lab Meeting 6
- Weekly Meeting 8
- Lab Meeting 7
- Lab Meeting 8
- Weekly Meeting 9
- Requirements
- Elicitation Questions
- Project Plan
- Use Case Diagram
- Sequence Diagrams
- Class Diagrams
- Front-End Mockups
- Mobile Mockups
- User Scenario 1
- User Scenario 2
- User Scenario 3
- User Scenario 4
- User Scenario 5
- RAM
- Tags Documentation
- Domain Specific Improvement Ideas
- Lab-6 User Stories
- Customer Milestone 2 Plan
- Software Quality Plan
- Implemented Requirements For Milestone 2
- Customer Milestone 3 Plan
📅 Meetings
- Meeting 1
- Meeting 2
- Meeting 3
- Meeting 4
- Meeting 5
- Meeting 6
- Meeting 7
- Meeting 8
- Meeting 9
- Meeting 10 - Class Diagrams
- Meeting - Frontend 1
- Meeting - Backend 1
- Meeting 11
- Meeting - Backend 2 Wikidata
- Meeting - Frontend 2
- Meeting - Deployment
- Meeting - Frontend 3
- Meeting 12
- Meeting - Backend 3
- Meeting - Backend 4
- Meeting - Frontend 4
- Meeting 13
- Meeting 14
- Meeting 15
- Meeting 16
💻 Project
- Class Diagrams
- Sequence Diagrams
- Use Case Diagrams
- Requirements
- Elicitation Questions
- Project Plan
- Work Done By Each Member
- Milestone Report 1
- Scenarios-Mockups
- Responsibility Assignment Matrix
- Responsibility Assignment Matrix Old Version
- Related Software Analysis
- Workdone Each Member Milestone 2
- Milestone 2 Report
- Work Done By Each Member Milestone 3
- RAM 3
- Milestone Report 3