使用Django创建RESTful API
Agenda
1.What is an api
Api refers to application programming interface
It is a set of subroutine definitations, protocols and tools for building application software.
It helps in connecitng various software components
An api make it easier for developers to use certain technologies in building applications by using certain predefined operations.
2.Introduciton to Rest Framework
- It describe an architecture which stands for REpresentaionl State Transfer
- It is used for web based architecture for data communication
- It uses HTTP to make calls between machines
The following HTTP methods are most commonly used in a REST based architecture:
GET records and retrieve the data
PUT is used to change the state or update a resources which can be a file it can be object or any block
POST is usually used to create the resources
DELETE is used to remove that resource
3.What is REST API?
When Web Service use REST architecture, they are called RESTFul APIs or REST APIs.
A REST API is a set of web addresses that respond with pure information, not a formatted web pge
An api returens json, which is a common format. You'll see all of information surrounded with quotation marks, {} ,[] and descriptive titles for each bit of info.
4.Demo-Create a Restful api
Open the terminal and type the following command for Django installation
pip install djangorestframework
python manage.py makemigrations
python manage.py migrate
Create a user

run server:
python manage.py runserver
References:
Video Django Rest Framework | How to Create a RESTful API Using Django | Django Tutorial | Edureka
使用Django创建RESTful API的更多相关文章
- Django编写RESTful API(一):序列化
欢迎访问我的个人网站:www.comingnext.cn 关于RESTful API 现在,在开发的过程中,我们经常会听到前后端分离这个技术名词,顾名思义,就是前台的开发和后台的开发分离开.这个技术方 ...
- Django编写RESTful API(四):认证和权限
欢迎访问我的个人网站:www.comingnext.cn 前言: 按照前面几篇文章里那样做,使用Django编写RESTful API的基本功能已经像模像样了.我们可以通过不同的URL访问到不同的资源 ...
- python 全栈开发,Day95(RESTful API介绍,基于Django实现RESTful API,DRF 序列化)
昨日内容回顾 1. rest framework serializer(序列化)的简单使用 QuerySet([ obj, obj, obj]) --> JSON格式数据 0. 安装和导入: p ...
- Django编写RESTful API(二):请求和响应
欢迎访问我的个人网站:www.comingnext.cn 前言 在上一篇文章,已经实现了访问指定URL就返回了指定的数据,这也体现了RESTful API的一个理念,每一个URL代表着一个资源.当然我 ...
- 利用Django实现RESTful API(一)
RESTful API现在很流行,这里是它的介绍 理解RESTful架构和 RESTful API设计指南.按照Django的常规方法当然也可以实现REST,但有一种更快捷.强大的方法,那就是 Dja ...
- Django之Restful API
理解Restful架构:http://www.ruanyifeng.com/blog/2011/09/restful RESTful设计指南:http://www.ruanyifeng.com/blo ...
- 【从0到1,搭建Spring Boot+RESTful API+Shiro+Mybatis+SQLServer权限系统】03、创建RESTful API,并统一处理返回值
本节应用Spring对RESTful的支持,使用了如@RestController等注解实现RESTful控制器. 如果对Spring中的RESTful不太明白,请查看相关书籍 1.创建一个数据对象, ...
- Django编写RESTful API(五):添加超链接提高模型间的关联性
前言 在第四篇中,加入了用户模型,以及相关的认证和权限的功能.但是我们在使用的时候,会发现在访问http://127.0.0.1:8000/users/时看到的用户列表,不能够直接点击某个链接然后查看 ...
- Django编写RESTful API(六):ViewSets和Routers
欢迎访问我的个人网站:www.comingnext.cn 前言 在本系列的文章中,我在第一篇和第二篇文章中写的编写Django视图时,使用的都是基于函数的方法,并且每个视图函数之前都会加一个djang ...
随机推荐
- [笔记] Git 冲突处理
这是一篇关于 git 解冲突的笔记,没有什么干货. TortoiseGit 小乌龟 通常情况下,会比较喜欢使用小乌龟解冲突,详见:git 使用 tortoisegit 解冲突 但部分复杂的场景,反而需 ...
- B+树的算法(java实现)
定义 一颗m阶B+树满足以下几个条件: 1.除根节点外的节点的关键字个数最大为m-1,最小为m/2 2.除叶节点外的每个节点的孩子节点的数目为该节点关键字个数加一,这些孩子节点的的关键字的范围与父节点 ...
- 数据库系统(五)---MySQL基础
一.SQL基本概念: SQL 已经成为关系数据库的标准语言,是一种数据库查询和程序设计语言,用 于存取数据以及查询.更新和管理关系数据库系统. 功能不仅仅是查询,还包括数据定义.数据操纵和数据控制等于 ...
- 全球唯一标识符 System.Guid.NewGuid().ToString()
System.Guid.NewGuid().ToString(); //ToString() 为 null 或空字符串 (""),则使用"D". 结果:8209 ...
- C++学习03_引用
基本使用 C++提供了给变量命名的机制,就是引用(Reference).引用是一种复合类型. //语法 数据类型 &name=data 注意,引用在定义时需要添加&,在使用时不能添加& ...
- SpringMVC Junit Demo
package com.zchx.test; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.L ...
- ConcurrentSkipListMap的常用方法
package com.geo.map; import java.util.Iterator;import java.util.Map.Entry;import java.util.Set;impo ...
- 201871010109-胡欢欢《面向对象程序设计(java)》第十二周学习总结
201871010109-胡欢欢<面向对象程序设计(java)>第十二周学习总结 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这 ...
- 201871010124--王生涛--《面向对象程序设计(java)》第十二周学习总结
博文正文开头格式: 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/nw ...
- 201871010132--张潇潇--《面向对象程序设计(java)》第十六周学习总结
博文正文开头格式:(2分) 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh 这个作业的要求在哪里 https://www.cnblogs.c ...