Upload
tun-yu-chang
View
475
Download
0
Embed Size (px)
Citation preview
About me
● Cobalt Chang
● From Application Software, Network & Communication Solutions BG, Nexcom International Co., Ltd.
●
● Software RD of an industry computer company?
– Production testing?
What we do?
● AngularJS + Django
● Version control, Test spec
● Gitlab, Continuous Integration(CI)
● Docker
● Kanban, Lean startup in the enterprise
●
– https://www.linkedin.com/in/tun-yu-chang-7965279a
Outline
● Introdustion to RESTful API
● Packages for building API
– Django REST Framework
– Djoser● Packages for documenting API
– Django REST Swagger
– Sphinx (not in this talking)● Demo
● Appendix
●RESTful API - REST
● REST, Representational State Transfer
– Resource● Uniform Resource Identifier (URI)
– Representation● html, xml, json, etc.
– State Transfer● well-defined operations
●RESTful API - RESTful
● The formal REST constraints are
– Client–server
– Stateless
– Cacheable
– Layered system
– Uniform interface● It's RESTful
●RESTful API - APIs
● For example, RESTful Web APIs
– base URI, such as http://example.com/resources/
– often JSON resources, but can be others
– standard HTTP methods
– hypertext links to reference state
Resource GET PUT POST DELETE
Collection URI, such as http://api.example.com/resources/
List Replace Create Delete
Element URI, such as http://api.example.com/resources/item17
Retrieve Replace / Create
Create Delete
https://en.wikipedia.org/wiki/Representational_state_transfer#Applied_to_web_services
●Django REST Framework
● Django REST framework is a powerful and flexible toolkit for building Web APIs
● http://www.django-rest-framework.org/
●Djoser
● REST implementation of Django authentication system
● https://github.com/sunscrapers/djoser
● Authentication
– HTTP basic authentication
– Token based authentication● Features
– Register a new user
– Activate the user
– Send email to set new password
●Django REST Swagger
● An API documentation generator for Swagger UI and Django REST Framework
● https://github.com/marcgibbons/django-rest-swagger
Appendix
● Similar projects on DRF
– django-rest-auth
https://github.com/Tivix/django-rest-auth
– django-rest-framework-jwt
https://github.com/GetBlimp/django-rest-framework-jwt
– ...
Appendix
● Other API Creations
– Django-tastypie
– Piston
– ...● https://www.djangopackages.com/grids/g/api/