-
Notifications
You must be signed in to change notification settings - Fork 0
API Documentation
Let's an existing user login by sending its username and password. Attaches auth cookies to the response.
POST api/login
{
"username": "",
"password": ""
}
{
"message": "Login successful",
"username": "",
"user_id": "",
"name": "",
"surname": "",
"email": "",
"labels": ""
}
{
"error": "Invalid username or password",
}
Let's a user register to Spot On.
POST api/register
{
"name": "",
"surname": "",
"username": "",
"email": "",
"password": "",
"labels": ""
}
{
"message": "Registration successful",
"username": "",
"user_id": "",
"name": "",
"surname": "",
"email": "",
"labels": ""
}
{
"error": "Username already exists"
}
{
"error": "Email already registered"
}
Initializes the "forgot password" workflow. When this endpoint is called, if the user with the email provided exists, the user gets an email that has a link to the password reset page.
POST api/forget-password
{
"email": ""
}
{
"success": "We have sent you a link to reset your password"
}
{
"error": "User with credentials not found"
}
The second part of the "forget password" workflow. The request must have a valid "reset token". The "reset token" is only given to the user via an email, that has the reset token embedded in the spotonapp.win url.
POST api/reset-password
{
"token": "",
"new_password": "",
"confirm_password": ""
}
{
"success": "Password updated"
}
{
"error": "Passwords do not match"
}
{
"error": "No user found"
}
Gets the current authenticated user.
GET api/get_user
{
"message": "User details retrieved",
"username": "",
"user_id": "",
"name": "",
"surname": "",
"email": "",
"labels": ""
}
{
"error": "User not authenticated"
}
Current authenticated user is logged out.
POST api/logout
{
"message": "Logout successful"
}
Follows a user. Must be authenticated.
POST api/follow/<int: user_id>
{
"message": "You are now following ..."
}
Unfollows a user. Must be authenticated
POST api/unfollow/<int: user_id>
{
"message": "You have unfollowed ..."
}
Create a post. Must be authenticated.
POST api/create-post
{
"link": "",
"image": "",
"comment": "",
"latitude": "",
"longitude": "",
}
{
"message": "Post created successfully",
"post_id": ""
}
{
"error": "Failed to fetch content description"
}
Gets a user's posts. Must be authenticated.
GET api/get-user-posts?user_id=&page_number=&page_size=
{
"posts": [
{
"id": "",
"comment": "",
"image": "",
"link": "",
"created_at": "",
"total_likes": "",
"total_dislikes": "",
"tags": [""]
}
],
"current_page": "",
"total_pages": "",
"total_posts": ""
}
Get specific post(s) by providing either:
- post id: Get post with ID
- post link: Get all posts for spotify link
- start date & end date: Posts between date
The last option returns paginated data and requires fields page_number and page_size to be present.
POST api/get-posts
{
"post_id": "",
}
or
POST api/get-posts
{
"post_link": "",
}
or
POST api/get-posts
{
"start_date": "",
"end_date": "",
"page_number": "",
"page_size": "",
}
{
"id": "",
"comment": "",
"image": "",
"link": "",
"created_at": "",
"total_likes": "",
"total_dislikes": "",
"content": {
"id": "",
"link": "",
"description": "",
"content_type": ""
}
"tags": [""]
}
"posts": [
{
"id": "",
"comment": "",
"image": "",
"link": "",
"created_at": "",
"total_likes": "",
"total_dislikes": "",
"content": {
"id": "",
"link": "",
"description": "",
"content_type": ""
}
"tags": [""]
}
]
Likes a post. Must be authenticated.
POST api/posts/<int:post_id>/like
{
"status": "success",
"message": "Post liked"
}
{
"status": "success",
"message": "Post not found"
}
{
"status": "success",
"message": "Post already liked"
}
Dislike post. Must be authenticated.
POST api/posts/<int:post_id>/dislike
{
"status": "success",
"message": "Post disliked"
}
{
"status": "success",
"message": "Post not found"
}
{
"status": "success",
"message": "Post already disliked"
}
Most shared posts nearby the user. Must be authenticated.
GET api/most-shared-nearby-things?latitude=&longitude=&radius=&page=&size=
{
"songs": [
{
"id": "",
"comment": "",
"image": "",
"link": "",
"created_at": "",
"total_likes": "",
"total_dislikes": "",
"content": {
"id": "",
"link": "",
"description": "",
"content_type": ""
}
"tags": [""]
}
],
"pagination": {
"page": "",
"size": "",
"total_pages": "",
"total_songs": ""
}
}
{
"error": "Invalid input for latitude, longitude, radius, page, or size."
}
Saves what user plays. Must be authenticated.
POST api/save-now-playing
{
"link": "",
"latitude": "",
"longitude": ""
}
{
"message": "Now playing data saved successfully.",
"id": ""
}
Returns most listened songs nearby a user. Must be authenticated.
GET api/most-listened-nearby?latitude=&longitude=&radius=
{
"tracks": [
{
"link": "",
"description": "",
"count": ""
}
]
}
Search in posts on Spot On
GET api/search?search=&page=&page_size=
{
"total_results": "",
"page": "",
"page_size": "",
"contents": [
{
"id": "",
"link": "",
"description": "",
"content_type": "",
}
]
}