Postman与接口文档


一.接口文档

1.怎么做接口测试

发送Request的请求信息以及Response的响应信息:
1、使用浏览器的network
2、使用charles的工具
3、查看开发的接口文档

2.查看接口文档

YAPI平台:http://yapi.smart-xwork.cn/

二.Postman

1.使用Postman与接口文档做接口测试

1.1GET请求

接口文档地址:http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?op=getMobileCodeInfo

接口文档:

GET /WebServices/MobileCodeWS.asmx/getMobileCodeInfo?mobileCode=string&userID=string 
Host: ws.webxml.com.cn
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
string

请求参数:

输入参数:mobileCode = 字符串(手机号码,最少前7位数字),userID = 字符串(商业用户ID) 
免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)。

 1.2Post请求

1.2.1请求数据为xml格式

请求文档地址
http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?op=getMobileCodeInfo
请求文档
请求方法&请求头&请求地址
POST /WebServices/MobileCodeWS.asmx HTTP/1.1
Host: ws.webxml.com.cn
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://WebXml.com.cn/getMobileCodeInfo"
请求参数
输入参数:mobileCode = 字符串(手机号码,最少前7位数字),userID = 字符串(商业用户ID) 
免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)。
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <getMobileCodeInfo xmlns="http://WebXml.com.cn/">
      <mobileCode>stringmobileCode>
      <userID>stringuserID>
    getMobileCodeInfo>
  soap:Body>
soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

  响应参数

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <getMobileCodeInfoResponse xmlns="http://WebXml.com.cn/">
      <getMobileCodeInfoResult>stringgetMobileCodeInfoResult>
    getMobileCodeInfoResponse>
  soap:Body>
soap:Envelope>

1.2.2请求数据为表单格式

接口文档地址

接口文档
请求方法&请求地址&请求头

POST /WebServices/MobileCodeWS.asmx/getMobileCodeInfo HTTP/1.1 Host: ws.webxml.com.cn Content-Type: application/x-www-form-urlencoded Content-Length: length
请求参数

mobileCode=string&userID=string HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length
响应参数:

<?
xml version="1.0" encoding="utf-8"?> <string xmlns="http://WebXml.com.cn/">stringstring>