Skip to content

The Django REST Framework API Example is a streamlined template for creating highly efficient RESTful APIs with Django. It demonstrates essential CRUD operations for a `Data` model, providing developers with a concise and optimized foundation to quickly develop robust APIs using the Django framework.

Notifications You must be signed in to change notification settings

nassrkhan/Django-Rest-API-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django REST Framework API Example

This is a simple Django project demonstrating basic CRUD operations for a Data model using the Django REST Framework.

Installation

  1. Clone the repository:

    git clone https://github.com/nassrkhan/Django-Rest-API-Project.git
  2. Install the required dependencies:

    pip install -r requirements.txt
  3. Apply database migrations: bash python manage.py migrate

  4. Run the development server: bash python manage.py runserver The API will be accessible at http://127.0.0.1:8000/.

API Endpoints

  1. Get Data URL: /data/ Method: GET Description: Retrieve a list of all data objects.
  2. Post Data URL: /data/new/

Method: POST

Description: Create a new data object.

Data Format:

json Copy code { "name": "Example Name", "description": "Example Description" } 3. Get Data Detail URL: /data/int:pk/ Method: GET Description: Retrieve details of a specific data object. 4. Put Data URL: /data/int:pk/edit/

Method: PUT

Description: Update details of a specific data object.

Data Format:

json Copy code { "name": "Updated Name", "description": "Updated Description" } 5. Delete Data URL: /data/int:pk/delete/ Method: DELETE Description: Delete a specific data object. Example Usage Using curl Create a new data object:

bash curl -X POST -H "Content-Type: application/json" -d '{"name": "New Data", "description": "New Description"}' http://127.0.0.1:8000/data/new/ Get all data: bash curl http://127.0.0.1:8000/data/

Contributing Feel free to contribute to this project by opening issues or creating pull requests.

About

The Django REST Framework API Example is a streamlined template for creating highly efficient RESTful APIs with Django. It demonstrates essential CRUD operations for a `Data` model, providing developers with a concise and optimized foundation to quickly develop robust APIs using the Django framework.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages