This document outlines the API endpoints for the Here app, a location-based AR social app. The API is designed to facilitate the app's core functionalities including authentication message mangement, replies mangement, and user mangemenet.
For access to the API, please reach out to [email protected] to request the X-API-Key
, which is required for authentication and access control.
Our backend services are deployed on Vercel. The data is stored and managed with MongoDB Atlas.
Below you will find detailed descriptions of each endpoint, including the HTTP methods, request URLs, necessary parameters, expected request and examples of use.
- Base URL
- Authentication Endpoints
- User Endpoints
- Message Endpoints
- Reply Endpoints
- Metrics Endpoints
- Base URL:
https://here-swe.vercel.app/
Creates a new user account.
- Endpoint:
POST /auth/register
- Body:
{
"userName": "JohnD",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"password": "secretpassword"
}
Authenticates a user and returns user data if successful.
- Endpoint:
POST /auth/login
- Body:
{
"inputLogin": "JohnD",
"password": "secretpassword"
}
Search for a user by their email address or username. Do not need to include both.
- Endpoint:
GET /user/search
- Body:
{
"email": "[email protected]",
"userName": "JohnD"
}
Retrieve a user by their unique identifier.
- Endpoint:
GET /user/:userId
Retrieve a list of friends for a user.
- Endpoint:
GET /user/:userId/friends
Retrieve messages for a user.
- Endpoint:
GET /user/:userId/messages
Add a friend to a user's friend list by their user ID. This will also add the user to the friend's friend list.
- Endpoint:
PUT /user/:userId/friends
- Body:
{ "friendId": "friendUserId" }
Add a friend to a user's friend list by their username. This endpoint functions similarly to adding by ID, but uses the friend's username instead.
- Endpoint:
PUT /user/:userId/friends_name
- Body:
{ "friendName": "friendUserName" }
Remove a friend from a user's friend list using the friend's user ID. This also removes the user from the friend's friend list.
- Endpoint:
DELETE /user/:userId/friends
- Body:
{ "friendId": "friendUserId" }
Remove a friend from a user's friend list using the friend's username. Functions similarly to removing by ID, but targets the friend by their username.
- Endpoint:
DELETE /user/:userId/friends_name
- Body:
{ "friendName": "friendUserName" }
Toggle the notification setting for a user's friends.
- Endpoint:
PUT /user/:userId/toggle-notify-friends
Update a user's profile information.
- Endpoint:
PUT /user/:userId/update-profile
- Body:
{
"userName": "newUserName",
"password": "newPassword",
"firstName": "newFirstName",
"lastName": "newLastName",
"email": "[email protected]",
"avatar": "urlToAvatar"
}
Delete a user and their associated messages.
- Endpoint:
DELETE /user/:userId
Gets all the messages in the database
- Endpoint:
GET /message/get_all_messages
Allows a user to post a message.
- Endpoint:
POST /message/post_message
- Body:
{
"user_id": "653d51478ff5b3c9ace45c26",
"text": "Hi, this is a test message - Jane",
"visibility": "friends",
"location": {
"type": "Point",
"coordinates": [40.7128, -74.0060]
}
}
Allows a user to delete their message.
- Endpoint:
POST /message/delete_message
- Body:
{
"messageId": "653d62a37ce9c61f28dcaa7f"
}
Increments the number of likes on a message.
- Endpoint:
POST /message/increment_likes
- Body:
{
"id": "653d62de7ce9c61f28dcaa87"
}
Changes the visibility of a user's message.
- Endpoint:
POST /message/change_visibility
- Body:
{
"id": "653d62de7ce9c61f28dcaa87",
"new_visibility": "public"
}
Increments the number of likes on a reply.
- Endpoint:
GET /reply/like_reply
- Body:
{
"reply_id": "653d62de7ce9c61f28dcaa87"
}
Add a reply to a message.
- Endpoint:
POST /reply/reply_to_message
- Body:
{
"message_id": "653ea4a35b858b2542ea4f13",
"content": "this is a test reply to a test message"
}
Creates a new metrics record.
- Endpoint:
POST /metrics/create-metrics
- Body:
{
"toalDistribution": 50
}
Retrieves a metrics record by its name.
- Endpoint:
POST /metrics/get-metrics
- Body:
{
"metricsName": "DailyUserVisits"
}
Increments the click count of a specified metrics record by 1.
- Endpoint:
POST /metrics/increment-clicks
- Body:
{
"metricsName": "DailyUserVisits"
}
Update total distribution for a metric.
- Endpoint:
POST /metrics/update-total-distribution
- Body:
{
"metricsName": "DailyUserVisits",
"newTotalDistribution": "1000"
}