Friday, October 2, 2015

Rest API with Django Rest Framework



How to Create a RestAPI's with Django Rest Framework 




When I start to write rest api's in django i used django-tastypie , but the problem is  almost all the my clients and my friends are done RestAPI's  it in DRF(Django Rest Framework) , so i forced  to learn DRF. when i start write Rest API's with DRF it's really going awesome.I am currently using Django REST Framework quite extensively.  It is really easy to extend their Serializer base class to create custom serializers and resources, although their default Serializer handles a lot of different types so you may not need to.  I'll admit the documentation for DRF is a bit disorganized, but the source code itself is well-documented and there are good examples included in the documentation.  

I decided on using DRF after getting started trying to do the same thing with TastyPie.  (In case you didn't know, Piston isn't being actively maintained, last time I checked.)   I found DRF to be more flexible than TastyPie, less opinionated, and wonderfully architected.  And the API Browser that comes automatically with DRF has proved itself to be invaluable.  The framework is seriously in the top two or three Django add-ons that I've found as far as quality, ease-of-use, and ingenuity goes, its a wonder that the documentation isn't up to par with the framework itself.

please clone my git project then you can see the how i create rest API's for a movie store , it include the database and everything,
Just clone the project locally and install the package using pip install -r requirements.txt , and run it locally you can see the movie list , filtering and all 
The project Description : This Project have two user  admin and User , admin can add , edit ,remove movies and the user can only see and searching the movies , this project telling you about the permissions and searching, filtering and etc, 
credentials for the admin user is : username : admin , password : admin

git hub url is : https://github.com/renjithsraj/storemovie

heroku url is : storemovie.herokuapp.com


6 comments: