zl程序教程

您现在的位置是:首页 >  后端

当前栏目

Postman:Postman简介、安装、入门使用方法详细攻略

方法安装postman入门 详细 简介 攻略 使用
2023-09-14 09:04:52 时间

Postman:Postman简介、安装、入门使用方法详细攻略

 

 

目录

Postman简介

Postman安装

Postman入门

1、图文教程

1.1、get案例

1.2、post案例

1.3、get案例

1.4、post案例

1.5、get案例


 

 

Postman简介

     开发API后,用于API测试的工具。在我们平时开发中,特别是需要与接口打交道时,无论是写接口还是用接口,拿到接口后肯定都得提前测试一下。在开发APP接口的过程中,一般接口写完之后,后端开发都会模拟调用一下请求。在用Postman之前,对于一般的get请求我基本都会用浏览器来简单模拟。而对于post请求,我一般习惯写代码来调用。可以用Java来模拟,当然用Python会更简洁。但是还有有很多弊端,不便于管理、维护困难等。Postman具有每个API开发人员的功能:请求构建,测试和预请求脚本,变量,环境和请求描述,旨在无缝地一起工作。

      这样的话就非常需要有一个比较给力的Http请求模拟工具,现在流行的这种工具也挺多的,像火狐浏览器插件-RESTClient,Chrome浏览器插件-Postman等等。这里主要介绍一下,一款模拟请求的利器Postman。

     Postman是一种网页调试与发送网页http请求的chrome插件。我们可以用来很方便的模拟get或者post或者其他方式的请求来调试接口。在Postman中,请求可以保存,也就类似于文件。而Collection类似文件夹,可以把同一个项目的请求放在一个Collection里方便管理和分享,Collection里面也可以再建文件夹。

 

 

Postman安装

官网地址https://www.getpostman.com/downloads/   
安装非常简单,下载直接安装即可!

1、此方法需要FQ,在安装时,最好是通过chrome浏览器打开chrome网上应用店直接添加到chrome插件中。如果是直接从网上先把postman下载好很可能按不到chrome上去。

 

 

Postman入门

相关文章Postman:Postman(HTTP的测试工具)使用方法详细攻略

1、图文教程

1.1、get案例

http://localhost:5000/mine

{
  "index": 2,
  "message": "New Block Forged",
  "previous_hash": "bcf967686847793897aab280b106ea30017c439aaeec21c9c7bd95472158268f",
  "proof": 12383,
  "transactions": [
    {
      "amount": 1,
      "recipient": "b5ae874dc9324a128f4889f89e340112",
      "sender": "0"
    }
  ]
}

1.2、post案例

http://localhost:5000/transactions/new

{
 "sender": "b5ae874dc9324a128f4889f89e340112",
 "recipient": "someone else's address",
 "amount": 5
}

{
  "message": "Transaction will be added to Block 3"
}

1.3、get案例

http://localhost:5000/chain

{
  "chain": [
    {
      "index": 1,
      "previous_hash": "1",
      "proof": 100,
      "timestamp": 1523154040.807251,
      "transactions": []
    },
    {
      "index": 2,
      "previous_hash": "bcf967686847793897aab280b106ea30017c439aaeec21c9c7bd95472158268f",
      "proof": 12383,
      "timestamp": 1523154095.569124,
      "transactions": [
        {
          "amount": 1,
          "recipient": "b5ae874dc9324a128f4889f89e340112",
          "sender": "0"
        }
      ]
    }
  ],
  "length": 2
}

pipenv run python blockchain.py
pipenv run python blockchain.py -p 5001

 

1.4、post案例

{
	"nodes":["http://127.0.0.1:5001"]
}

{
  "message": "New nodes have been added",
  "total_nodes": [
    "127.0.0.1:5001"
  ]
}

 

1.5、get案例

 

参考博文API  自动化测试利器——Postman