Skip to content

sulasoft/upexam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

UpExam Django API

This is a Django REST Framework (DRF) API project that manages user profiles.

Getting Started

  1. Clone this repository:

    git clone https://github.com/sulasoft/upexam.git
  2. Navigate to the project directory:

    cd upexam
  3. Create a virtual environment and activate it:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  4. Install dependencies:

    pip install -r requirements.txt
  5. Create migrations:

    python manage.py makemigrations
  6. Apply migrations:

    python manage.py migrate
  7. Run the development server:

    python manage.py runserver
  8. Access the API documentation at http://localhost:8000/.

API Endpoints

User Endpoints:

  • 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/

Profile Endpoints:

  • 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/

Notes

  • 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published