This is a Django REST Framework (DRF) API project that manages user profiles.
-
Clone this repository:
git clone https://github.com/sulasoft/upexam.git
-
Navigate to the project directory:
cd upexam
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create migrations:
python manage.py makemigrations
-
Apply migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
-
Access the API documentation at http://localhost:8000/.
-
GET /users/: Retrieve a list of users.
curl http://localhost:8000/users/
-
POST /users/: Create a new user.
curl -X POST http://localhost:8000/users/ -H "Content-Type: application/json" -d '{ "email": "[email protected]" }'
-
GET /users/int:pk/: Retrieve details of a specific user.
curl http://localhost:8000/users/1/
-
PUT /users/int:pk/: Update details of a specific user.
curl -X PUT http://localhost:8000/users/3/ -H "Content-Type: application/json" -d '{ "favorite_profiles": [2,3] }'
-
DELETE /users/int:pk/: Delete a specific user.
curl -X DELETE http://localhost:8000/users/1/
-
GET /profiles/: Retrieve a list of profiles.
curl http://localhost:8000/profiles/
-
POST /profiles/: Create a new profile.
curl -X POST http://localhost:8000/profiles/ -H "Content-Type: application/json" -d '{ "name": "Profile Example", "description": "This is an example", "user": 2 }'
-
GET /profiles/int:pk/: Retrieve details of a specific profile.
curl http://localhost:8000/profiles/1/
-
PUT /profiles/int:pk/: Update details of a specific profile.
curl -X PUT http://localhost:8000/profiles/3/ -H "Content-Type: application/json" -d '{ "name": "Updated Profile", "description": "Updated description" }'
-
DELETE /profiles/int:pk/: Delete a specific profile.
curl -X DELETE http://localhost:8000/profiles/1/
-
The API documentation is available at the root path http://localhost:8000/.
-
Use the provided requirements file for dependencies.
-
Use the provided requirements file for dependencies.