使用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 ...
随机推荐
- TEXT_CONVERT_XLS_TO_SAP 错误排查
转自:https://blog.csdn.net/ityangjia/article/details/88827308 本文链接:https://blog.csdn.net/ityangjia/art ...
- Linux软件安装——安装软件的命令
Linux软件安装——安装软件的命令 摘要:本文主要学习了如何在Linux系统中安装.更新.卸载软件. rpm命令 rpm命令用来在Linux系统上进行软件的安装. 基本语法 安装命令: rpm -i ...
- EurekaServer自动装配及启动流程解析
在开始本篇文章之前,我想你对SpringCloud和SpringBoot的基本使用已经比较熟悉了,如果不熟悉的话可以参考我之前写过的文章 本篇文章的源码基于SpringBoot2.0,SpringCl ...
- CMake编译的VS工程,安装时遇到错误:error MSB3073: 命令“setlocal
错误提示 70>CMake Error at src/base/cmake_install.cmake:63 (file): 70> file INSTALL cannot find 70 ...
- SAP 如何得到交货单上的序列号清单?
SAP 如何得到交货单上的序列号清单? 以内向交货单为例(外向交货单方法了类似)予以说明. 1)VL33N,在交货单显示界面, 但是没办法通过这个界面里导出序列号清单. 2),只能通过查表的方式导出序 ...
- SQL server 无法更新标识列
若是数据库设置了自增长字段,相应的Model也要做标记,否则修改数据的时候会提示无法更新条目 /// <summary> /// 自增长ID /// </summary> [D ...
- [TCP/IP] TCP第三次握手失败怎么办
三次握手 客户端 ==> SYN是1同步 ,ACK确认标志是0,seq序号是x ==> 服务器 客户端 <== SYN是1同步 ,ACK确认标志是1,seq序号是y,ack确认号是x ...
- 09事件传递参数-封装网络请求api get和post合并整合在一起
1==>通过点击事件进行传递参数 <view bindtap="goEdution" data-index="5">西南大学</view ...
- springboot-项目获取resources下文件的方法
spring项目获取resources下文件的方法 最近写读取模板文件做一些后续的处理,将文件放在了项目的resources 下,发现了一个好用的读取方法: 比如上边是你需要读取的文件: 读 ...
- Spring(003)-消费返回list的rest服务
通过spring提供的RestTemplate就可以访问rest服务.首先需要创建一个RestTemplate,这个需要手动来创建bean @Configuration public class De ...