git clone <repository_url>
cd <repository_directory>
Create a virtual environment:
python3 -m venv venv
Activate the virtual environment:
Linux: source venv/bin/activate
Windows: venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
OR
pip freeze > requirements.txt
Run migrations:
python manage.py makemigrations
python manage.py migrate
Start the Django server:
python manage.py runserver
The API should now be running at http://localhost:8000/.
-
Method: POST
-
Description: Logs a user in to the event app.
-
Parameters:
-
Email: string
-
pass_id: string
-
Method: GET
-
Description: Returns a list of events.
-
Example
curl -X GET https://team-piranha.onrender.com/api/events/
Endpoint: https://team-piranha.onrender.com/api/event/
Method: POST
Description: Saves the event to the database.
Parameters:
- title (string): Event title
- description (string): Event description
- location (string): Event location
- start_date (string): Event start date (YYYY-MM-DD)
- end_date (string): Event end date (YYYY-MM-DD)
- start_time (string): Event start time (HH:MM:SS)
- end_time (string): Event end time (HH:MM:SS)
- creator_id (integer): Creator's ID
Example
curl -X POST https://team-piranha.onrender.com/api/events/ -d "title=Sample Event" -d "description=This is a sample event" -d "location=Sample Location" -d "start_date=2023-09-21" -d "end_date=2023-09-22" -d "start_time=10:00:00" -d "end_time=12:00:00" -d "creator_id=1"
Endpoint: https://team-piranha.onrender.com/api/event/user/{id}
Method: GET
Description: Get an event posted by a user
Parameters:
- None
Example
curl -X 'GET' \'https://team-piranha.onrender.com/api/event/user/1/'
Endpoint: https://team-piranha.onrender.com/api/event/{id}
Method: GET
Description: Get a saved event by ID
Parameters:
- None
Example
curl -X 'GET' \'https://team-piranha.onrender.com/api/event/1/'
Endpoint: https://team-piranha.onrender.com/api/interested_event/
Method: POST
Description: Saves an interested event to the database.
Parameters:
- user_id: interger
- event_id: interger
Example
curl -X 'POST' \'https://team-piranha.onrender.com/api/interested_event/'
Endpoint: https://team-piranha.onrender.com/api/interested_event/accept/{id}
Method: POST
Description: Saves an event the user has accepted
Parameters:
- user_id: interger
- event_id: interger
- id: A unique integer value identifying this interested event.
Example
curl -X 'POST' \'https://team-piranha.onrender.com/api/interested_event/accept/2/
Endpoint: https://team-piranha.onrender.com/api/interested_event/event/{id}
Method: GET
Description: Gets an event the user has accepted
Parameters:
- None
Example
curl -X 'GET' 'https://team-piranha.onrender.com/api/interested_event/event/2/'
Endpoint: https://team-piranha.onrender.com/api/interested_event/{id}
Method: DELETE
Description: Deletes an interested event from the database
Parameters:
- None
Example
curl -X 'DELETE' 'https://team-piranha.onrender.com/api/interested_event/1/'
-
Endpoint:
https://team-piranha.onrender.com/api/groups/
-
Method: POST
-
Description: Creates a new group and saves it to the database.
-
Parameters:
title
(string): The title of the group.description
(string): A brief description of the group.location
(string): The location or meeting place of the group.creator_id
(integer): The ID of the user creating the group.
-
Example:
curl -X POST `https://team-piranha.onrender.com/api/groups/` \ -d "title=Sample Group" \ -d "description=This is a sample group" \ -d "location=Sample Location" \ -d "creator_id=1"
-
Endpoints:
https://team-piranha.onrender.com/api/groups/
-
Method: GET
-
Description: Returns a list of groups.
-
Example:
curl -X GET `https://team-piranha.onrender.com/api/groups/`
-
Endpoint:
https://team-piranha.onrender.com/api/groups/<int:pk>/
-
Method: GET
-
Description: Retrieves details of a specific group.
-
Example:
curl -X GET `https://team-piranha.onrender.com/api/groups/1/`
-
Endpoint:
https://team-piranha.onrender.com/api/groups/<int:pk>/update/
-
Method: PUT
-
Description: Updates group details.
-
Example:
curl -X PUT https://team-piranha.onrender.com/api/groups/1/update/ \
-d "title=Updated Group Title" \
-d "description=Updated group description"
-
Endpoint:
https://team-piranha.onrender.com/api/groups/<int:pk>/delete/
-
Method: DELETE
-
Description: Deletes a group.
-
Example:
curl -X DELETE https://team-piranha.onrender.com/api/groups/1/delete/
-
Endpoint:
https://team-piranha.onrender.com/api/groups/<int:groupId>/members/<int:userId>/
-
Method: POST
-
Description: Adds a user to a group.
-
Example:
curl -X POST https://team-piranha.onrender.com/api/groups/1/members/2/
-
Endpoint:
https://team-piranha.onrender.com/api/groups/<int:groupId>/members/<int:userId>/remove/
-
Method: DELETE
-
Description: Removes a user from a group.
-
Example:
curl -X DELETE https://team-piranha.onrender.com/api/groups/1/members/2/remove/
-
Endpoint:
https://team-piranha.onrender.com/api/groups/<int:groupId>/members/list/
-
Method: GET
-
Description: Retrieves a list of members in a group.
-
Example:
curl -X GET https://team-piranha.onrender.com/api/groups/1/members/list/
Each endpoint requires the group ID and, for adding/removing a user, the user ID. The group and user IDs should be replaced with the actual IDs in the URL.
This documentation provides details about the "Login" endpoint in our project. The login endpoint allows users to authenticate and obtain a token for access.
-
Endpoint:
https://team-piranha.onrender.com/api/login
-
Method: POST
-
Description: Authenticates a user and provides an access token for authorization.
-
Parameters: To authenticate and obtain a token, you need to provide the following parameters:
-
email
(string): The user's email address. -
pass_id
(string): The user's password or identifier for authentication.
Example
To authenticate and obtain a token, you can make a POST request as follows:
Copy code
curl -X POST https://team-piranha.onrender.com/api/login/ \
-d "[email protected]" \
-d "pass_id=yourpassword123"
*** Upon a successful login, the API will respond with a JSON object containing the access token and user information. The response may look something like this:***
JSON
{
"status": "success",
"message": "Login successful",
"data": {
"token": "your-access-token",
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"avatar": "https://team-piranha.onrender.com/api/media/profile.jpg"
}
}
The response includes the following information:
token
: The access token for authorization.id
: The user's unique identifier.name
: The user's name.email
: The user's email address.avatar
: The URL to the user's avatar image, if available.
This token can be used for subsequent requests to access protected endpoints that require authentication.