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的更多相关文章

  1. Django编写RESTful API(一):序列化

    欢迎访问我的个人网站:www.comingnext.cn 关于RESTful API 现在,在开发的过程中,我们经常会听到前后端分离这个技术名词,顾名思义,就是前台的开发和后台的开发分离开.这个技术方 ...

  2. Django编写RESTful API(四):认证和权限

    欢迎访问我的个人网站:www.comingnext.cn 前言: 按照前面几篇文章里那样做,使用Django编写RESTful API的基本功能已经像模像样了.我们可以通过不同的URL访问到不同的资源 ...

  3. python 全栈开发,Day95(RESTful API介绍,基于Django实现RESTful API,DRF 序列化)

    昨日内容回顾 1. rest framework serializer(序列化)的简单使用 QuerySet([ obj, obj, obj]) --> JSON格式数据 0. 安装和导入: p ...

  4. Django编写RESTful API(二):请求和响应

    欢迎访问我的个人网站:www.comingnext.cn 前言 在上一篇文章,已经实现了访问指定URL就返回了指定的数据,这也体现了RESTful API的一个理念,每一个URL代表着一个资源.当然我 ...

  5. 利用Django实现RESTful API(一)

    RESTful API现在很流行,这里是它的介绍 理解RESTful架构和 RESTful API设计指南.按照Django的常规方法当然也可以实现REST,但有一种更快捷.强大的方法,那就是 Dja ...

  6. Django之Restful API

    理解Restful架构:http://www.ruanyifeng.com/blog/2011/09/restful RESTful设计指南:http://www.ruanyifeng.com/blo ...

  7. 【从0到1,搭建Spring Boot+RESTful API+Shiro+Mybatis+SQLServer权限系统】03、创建RESTful API,并统一处理返回值

    本节应用Spring对RESTful的支持,使用了如@RestController等注解实现RESTful控制器. 如果对Spring中的RESTful不太明白,请查看相关书籍 1.创建一个数据对象, ...

  8. Django编写RESTful API(五):添加超链接提高模型间的关联性

    前言 在第四篇中,加入了用户模型,以及相关的认证和权限的功能.但是我们在使用的时候,会发现在访问http://127.0.0.1:8000/users/时看到的用户列表,不能够直接点击某个链接然后查看 ...

  9. Django编写RESTful API(六):ViewSets和Routers

    欢迎访问我的个人网站:www.comingnext.cn 前言 在本系列的文章中,我在第一篇和第二篇文章中写的编写Django视图时,使用的都是基于函数的方法,并且每个视图函数之前都会加一个djang ...

随机推荐

  1. Docker install in Linux

    install command sudo yum install -y yum-utils device-mapper-persistent-data lvm2 sudo yum-config-man ...

  2. 使用 docker-compose 运行 MySQL

    使用 docker-compose 运行 MySQL 目录结构 . │ .env │ docker-compose.yml │ └─mysql ├─config │ my.cnf │ └─data m ...

  3. BUUCTF--checkin

    文件上传文件上传一般验证方式:1.本地js验证(客户端)2.MIME验证(服务端)3.拓展名验证(服务端)4.脚本内容(文件头)验证(服务端) 通常会用到exif_imagetype()函数,这个函数 ...

  4. linux 修改文件打开数量限制

    1.查看打开文件数量限制 ulimit -a ulimit -n 2.临时修改 ulimit -n 2048 3.永久修改 vi /etc/security/limits.conf 追加 * soft ...

  5. GraphQL快速入门教程

    摘要: 体验神奇的GraphQL! 原文:GraphQL 入门详解 作者:MudOnTire Fundebug经授权转载,版权归原作者所有. GraphQL简介 定义 一种用于API调用的数据查询语言 ...

  6. 4、Work-Queue

    Work Queues using the Java Client In the first tutorial we wrote programs to send and receive messag ...

  7. 爬虫---Beautiful Soup 反反爬虫事例

    前两章简单的讲了Beautiful Soup的用法,在爬虫的过程中相信都遇到过一些反爬虫,如何跳过这些反爬虫呢?今天通过知乎网写一个简单的反爬中 什么是反爬虫 简单的说就是使用任何技术手段,阻止别人批 ...

  8. Flask框架整理及配置文件

    阅读目录 Flask目录结构(蓝图) pro_flask包的init.py文件, 用于注册所有的蓝图 manage.py文件,作为整个项目的启动文件 views包中的blog.py,必须要通过sess ...

  9. 如何防止XSS攻击?

    来自: https://www.freebuf.com/articles/web/185654.html 前端安全 随着互联网的高速发展,信息安全问题已经成为企业最为关注的焦点之一,而前端又是引发企业 ...

  10. 201871010117-石欣钰《面向对象程序设计(java)》第十五周学习总结

    项目 内容 这个作业属于哪个课程 <任课教师博客主页链接>https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 <作业链接地址>http ...