zoukankan      html  css  js  c++  java
  • http put post请求区别

    1、RESTful API

    REST: Representational State Transfer 

    url 对应服务器上的一种资源,e.g. 数据,图片等,所以url 中只含有名词,通过HTTP动词来描述对资源的操作方式。

    HTTP 动词

    • GET: 获取资源
    • POST:创建或更新资源
    • PUT: 创建或更新资源
    • DELETE:删除资源
    • HEAD:获取请求报文头部,不常用
    • OPTIONS:获取信息,关于资源的哪些属性是客户端可以改变的, 不常用

    2、put post区别

    POST:
    
    > modify and update a resource
    POST /questions/<existing_question> HTTP/1.1
    
    > create a resource:
    POST /questions HTTP/1.1
    
    > Note that the following is an error:
    POST /questions/<new_question> HTTP/1.1
    
    
    PUT:
    
    > To overwrite an existing resource:
    PUT /questions/<existing_question> HTTP/1.1
    
    > create a resource:
    PUT /questions/<new_question> HTTP/1.1

    在更新资源的操作上,POST 和 PUT 基本相同。

    在创建资源时,PUT可以指定资源路径,POST无法指定资源路径。

  • 相关阅读:
    感知机学习笔记
    NOIP 模拟19
    NOIP 模拟17
    NOIP模拟14-16
    「动态规划」-数位dp专题
    8.5 NOIP 模拟测试 13
    8.3 NOIP 模拟12题解
    8.3 NOIP CE反思
    「分治」-cdq分治
    8.1 NOIP模拟11
  • 原文地址:https://www.cnblogs.com/mengfangui/p/9642030.html
Copyright © 2011-2022 走看看