Postman使用手册范本.docx

上传人:b****6 文档编号:5363113 上传时间:2022-12-15 格式:DOCX 页数:16 大小:1.36MB
下载 相关 举报
Postman使用手册范本.docx_第1页
第1页 / 共16页
Postman使用手册范本.docx_第2页
第2页 / 共16页
Postman使用手册范本.docx_第3页
第3页 / 共16页
Postman使用手册范本.docx_第4页
第4页 / 共16页
Postman使用手册范本.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

Postman使用手册范本.docx

《Postman使用手册范本.docx》由会员分享,可在线阅读,更多相关《Postman使用手册范本.docx(16页珍藏版)》请在冰豆网上搜索。

Postman使用手册范本.docx

Postman使用手册范本

Postman使用手册

Sendingrequests--发送请求

ThePostmaninterfaceisdividedintotwoareas.Thesidebarontheleftandtherequestbuilderontheright.Therequestbuilderletsyoucreatealmostanykindofrequestquickly.ThefourpartsofanHTTPrequestaretheURL,method,headers,andthebody.Postmangivesyoutoolstoworkwitheachoftheseparts.

Postman界面分为两个区域。

侧边栏左边和右边的请求builder。

请求构建器允许您创建几乎任何类型的请求很快。

四个部分的一个HTTP请求的URL,方法,头,身体。

Postman给你工具来处理这些部分。

URL

TheURListhefirstthingthatyouwouldbesettingforarequest.TheURLinputfieldstoresURLsusedpreviouslyandwillshowanautocompletedropdownasyoubeginenteringyourURL.ClickingontheURLparamsbuttonwillopenupthekey-valueeditorforenteringURLparameters.

URL的第一件事,你会设置请求。

先前使用的URL输入字段存储URL并将显示自动完成下拉当你开始进入你的网址。

单击URL参数按钮将打开键-值编辑器输入URL参数

ParametersyouenterintheURLbarorinthekey/valueeditorwillnotautomaticallybeURL-encoded.Rightclickonapieceofselectedtext,andclickEncodeURIComponenttomanuallyencodetheparametervalue.

参数输入地址栏或键/值编辑器不会自动URL编码。

右击选中的文本,然后单击EncodeURIComponent手工编码参数值。

Youcanindividuallyaddkey/valuepairsandPostmanwillcombineeverythingtogether.IfyourURLalreadyhasparameters-forexample,ifyouarepastingaURLfromsomeothersource,PostmanwillsplittheURLintopairsautomatically.

您可以单独添加键/值对,postman会结合在一起的一切。

如果你的URL已经参数——例如,如果你是粘贴URL从其他来源,postman将URL分成自动配对

Headers

Clickingontheheaderstogglewillshowtheheaderskey-valueeditor.Youcansetanystringastheheadername.CommonheaderspartoftheHTTPspecareavailableinanauto-completedropdownwhenyoubegintypingtheheadername.Valuesforthe"Content-Type"headerarealsoavailableinanauto-completedropdown.

单击标题切换键值编辑器将显示头。

你可以设置任何字符串作为标题名称。

常见的HTTP标头部分规范在一个自动完成拉当你开始键入标题名称。

“内容类型”头的值也可以自动完成下拉。

Headerpresets

Youcansavecommonlyusedheaderstogetherinaheaderpreset.Youcanaddaheaderpresettoyourrequestbyclickingthe"Addpreset"buttonorbyselectingthepresetfromtheheaderdropdown.

您可以保存常用的标题在标题预设。

您可以添加一个头预定你的请求通过单击“添加预设”按钮或通过选择预设的标题下拉

Method

Changingthemethodisstraightforward.Justselectthemethodfromtheselectcontrol.Therequestbodyeditorareawillchangedependingonwhetherthemethodcanhaveabodyattachedtoitornot.

改变方法很简单。

只是选择方法从请求主体的选择控制。

编辑器区域将会改变取决于方法可以有身体连接到它。

Theabilitytoaddadditionalmethodsandtogglingwhetherabodycanbeattachedtoitwillbeaddedsoon

添加额外的方法和切换的能力是否身体可以被附加到它很快就会被添加

Requestbody

Whileconstructingrequests,youwouldbedealingwiththerequestbodyeditoralot.Postmanlet'syousendalmostanykindofHTTPrequest(Ifyoucan'tsendsomething,letusknow!

).Thebodyeditorisdividedinto4areasandhasdifferentcontrolsdependingonthebodytype.

而构建请求,您将处理请求主体编辑器。

postman让你送几乎任何类型的HTTP请求(如果你不能送东西,让我们知道!

)。

身体编辑分为4个区域,根据身体类型有不同的控制。

form-data

multipart/form-dataisthedefaultencodingawebformusestotransferdata.Thissimulatesfillingaformonawebsite,andsubmittingit.Theform-dataeditorletsyousetkey/valuepairs(usingthekey-valueeditor)foryourdata.Youcanattachfilestoakeyaswell.DonotethatduetorestrictionsoftheHTML5spec,filesarenotstoredinhistoryorcollections.Youwouldhavetoselectthefileagainatthetimeofsendingarequest.

多部分/格式数据是默认编码一个web表单使用传输数据。

这对一个网站模拟填充表单,并提交它。

格式数据编辑器允许您设置键/值对(使用键值编辑器)为您的数据,您可以将文件附加到一个关键。

做注意,由于HTML5规范的限制,文件不存储在历史或集合。

你会选择文件再次发送请求的时候。

urlencoded

ThisencodingisthesameastheoneusedinURLparameters.Youjustneedtoenterkey/valuepairsandPostmanwillencodethekeysandvaluesproperly.Notethatyoucannotuploadfilesthroughthisencodingmode.Theremightbesomeconfusionbetweenform-dataandurlencodedsomakesuretocheckwithyourAPIfirst.

这个编码是一样使用的URL参数。

你只需要输入键/值对,postman将编码键和值正常。

请注意,您不能上传文件通过这个编码模式。

可能会有一些混淆格式数据和urlencoded所以一定先检查你的API。

raw

Arawrequestcancontainanything.Postmandoesn'ttouchthestringenteredintheraweditorexceptreplacingenvironmentvariables.Whateveryouputinthetextareagetssentwiththerequest.Theraweditorletsyousettheformattingtypealongwiththecorrectheaderthatyoushouldsendwiththerawbody.YoucansettheContent-Typeheadermanuallyaswell.Normally,youwouldbesendingXMLorJSONdatahere.

原始请求可以包含任何东西。

postman不碰在原始编辑器中输入的字符串取代环境变量除外。

无论你的文本区域发送请求。

原始编辑器允许您设置格式类型以及正确的标题,你应该发送原始的身体。

你也可以手动设置content-type头。

通常,你会在这里发送XML或JSON数据。

binary

binarydataallowsyoutosendthingswhichyoucannotenterinPostman.Forexample,image,audioorvideofiles.Youcansendtextfilesaswell.Asmentionedearlierintheform-datasection,youwouldhavetoreattachafileifyouareloadingarequestthroughthehistoryorthecollection.

二进制数据允许你发送的东西你不能进入postman。

例如,图像,音频或视频文件。

您可以发送文本文件格式数据节。

正如前面提到的,你必须将一个文件加载请求通过历史或集合。

Workingwithresponses

EnsuringthattheAPIresponseiscorrectissomethingthatyouwillbedoingalot.ThePostmanresponseviewerwillmakethistaskmucheasierforyou.

确保API的反应是正确的,你会做很多。

postman响应查看器将使这项任务变得更简单。

AnAPIresponseconsistsofthebody,headersandthestatuscode.Postmanorganizesbodyandheadersindifferenttabs.ThestatuscodewiththetimetakenfortheAPIcallisdisplayednexttothetabs.Youcanhoveroverthestatuscodetogetmoredetailsaboutthecode.MostlyitwillbethedefaultdescriptionasmandatedbytheHTTPspecbutAPIauthorscanalsoaddcustommessages.

API的反应包括身体、头和状态码。

postman组织体在不同的标签和标题。

时间的状态代码旁边的API调用显示选项卡。

你可以悬停在状态代码更详细的代码。

主要是它将默认API描述HTTP规范强制要求的,但作者也可以添加自定义消息。

Savingresponses

Ifarequesthasbeensavedinacollection,youcansaveresponsesforthatrequest.Oncetheresponsehasbeenreceived,clickthe"Saveresponse"button.You'llbeabletosavetheresponsewithaname.Allresponsessavedforarequestwillbeavailablewheneveryouloadtherequest(abovetherequestURL).

如果请求被保存在一个集合,您可以保存响应请求。

只有在接收到响应后,单击“保存响应”按钮。

你可以保存响应与一个名字。

所有响应保存请求可以无论何时加载请求(在请求URL)。

Viewingresponses---查看回复

ThePostmanbodytabgivesyouseveraltoolstohelpyoumakesenseofthingsquickly.Thebodycanbeviewedinoneofthreeviews-pretty,raw,andpreview.

postman身体标签给你一些工具来帮助您理解事情很快。

身体可以在三种观点——漂亮,生和预览

Pretty

TheprettymodeformatsJSONorXMLresponsessothattheyareeasiertolookat.NobodywantstoscrollthroughaminifiedsinglelineJSONresponselookingforthatelusivestring!

LinksinsidetheprettymodearehighlightedandclickingonthemcanloadaGETrequestinPostmanwiththelinkURL.Byclickingonthelinenumbersontheleftyoucanfoldlargechunksoftheresponse.ForPostmantoautomaticallyformatthebody,makesuretheappropriateContent-Typeheaderisreturned.IftheAPIdoesnotdothisthenyoucanforceformattingthroughJSONorXML.Youcanenablethe"ForceJSON"settingaswell.

漂亮模式格式JSON或XML响应,这样他们更容易看。

没人想滚动一个缩小的单线JSON响应寻找难以捉摸的字符串!

突出漂亮的模式中的链接,点击可以加载一个GET请求的postman链接URL。

通过点击左边的行号你可以折叠大量响应。

postman自动格式,确保适当的内容类型返回头。

如果API不这样做,那么你可以迫使通过JSON或XML格式。

您可以启用“JSON力量”设置。

Note:

YoucanuseCmd+F/Ctrl+Ftoopenthesearchbar,andCmd+G/Ctrl+Gtoscrollthroughresults.

注意:

您可以使用Cmd+F/Ctrl+F打开搜索栏,和Cmd+G/Ctrl+G滚动结果。

Raw

Therawviewisjustabigtextareawiththeresponsebody.Itcanhelptotellwhetheryourresponseisminifiedornot.

原始的观点只是一个大文本区域响应的身体。

它可以帮助你判断反应是否缩小。

Preview

Thepreviewtabrenderstheresponseinasandboxediframe.SomewebframeworksbydefaultreturnHTMLerrorsandthepreviewmodeisespeciallyhelpfulthere.Duetoiframesandboxrestrictions,Javascriptandimagesaredisabledintheiframe.

preview选项卡呈现响应在沙箱iframe。

一些web框架默认返回HTML错误和preview模式尤其有帮助。

由于iframe沙箱限制,Javascript和iframe图像被禁用。

YoucanmaximizethebodytooccupythewholePostmanwindow.Incase,youplanonspendingalotoftimewiththeresponse,thisisthewaytogo.

你可以最大化的身体占据整个postman窗口。

在情况下,你计划花费了大量的时间和响应,这是路要走。

IfyourAPIendpointreturnsanimage,Postmanwilldetectandrenderitautomatically.Forbinaryresponsetypes,youshouldselect"Sendanddownload"whichwillletyousavetheresponsetoyourharddisk.Youcanthenviewitusingtheappropriateviewer.Thisgivesyoutheflexibilitytotestaudiofiles,PDFs,zipfilesoranythingthattheAPIthrowsatyou.

如果你的API端点返回一个形象,postman将自动检测并呈现它。

对于二进制响应类型,你应该选择“发送和下载”,会让你节省硬盘的响应。

然后你可以查看它使用适当的观众。

这使您的灵活性来测试音频文件,pdf,zip文件或任何API抛给你。

Headers

Headersaredisplayedaskey/valuepairsintheheadertab.HoveringovertheheadernamecangiveyouadescriptionoftheheaderaccordingtotheHTTPspec.IfyouaresendingaHEADrequest,Postmanwillshowtheheaderstabbydefault.

标题显示的键/值对标题标签。

徘徊在标题的名称可以给你描述标题根据HTTP规范。

如果你发送HEAD请求,postman将显示默认标题标签。

BasicAuth

Entertheusernameandpasswordfieldsandhit"Refreshheaders"togeneratetheauthorizationheader.

输入用户名和密码字段,并点击“刷新头”生成授权头。

DigestAuth

Digestauthismorecomplicatedthanbasicauthandusesthevaluescurrentlysetintherequesttogeneratetheauthorizationheader.Makesuretheyaresetproperlybeforeyougeneratetheheader.Postmanwillremovetheexistingheaderifit'salreadypresent.

消化身份验证是更复杂的比基本认证和使用请求中的值目前设置生成授权头。

确保他们正确设置之前生成标题。

postman会删除现有的头如果它已经存在。

OAuth1.0a

Postman'sOAuthhelperlet'syousignrequestswhichsupportOAuth1.0abasedauthentication.Currentlyitdoesnotletyouacquiretheaccesstoken.That'ssomethingyouwouldneedfromtheAPIprovider.TheOAuth1.0helpercansetvaluesineithertheheaderorasqueryparameters.

Postman的OAuth助手让你签署请求支持OAuth1.0基础认证。

目前它不让你获取访问令牌。

这是需要从API提供者。

OAuth1.0助手可以在标题或设置值作为查询参数。

AssubsequentOAuthrequestsmightexpectadifferentnoncevalue,PostmancanrefreshtheOAuthsignaturejustbeforetherequestissentifautoaddparametersisenabled.

后续的OAuth请求可能认为不同nonce价值,postman可以刷新OAuth签名发送请求之前如果启用了自动添加参数。

TheOAuth1.0specisquitecomplicated

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 高等教育 > 其它

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1