版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
..>Postman使用手册Sendingrequests--发送请求ThePostmaninterfaceisdividedintotwoareas.Thesidebarontheleftandtherequestbuilderontheright.Therequestbuilderletsyoucreatealmostanykindofrequestquickly.ThefourpartsofanrequestaretheURL,method,headers,andthebody.Postmangivesyoutoolstoworkwitheachoftheseparts.Postman界面分为两个区域。侧边栏左边和右边的请求builder。请求构建器允许您创立几乎任何类型的请求很快。四个局部的一个请求的URL,方法,头,身体。Postman给你工具来处理这些局部。URLTheURListhefirstthingthatyouwouldbesettingforarequest.TheURLinputfieldstoresURLsusedpreviouslyandwillshowanautocompletedropdownasyoubeginenteringyourURL.ClickingontheURLparamsbuttonwillopenupthekey-valueeditorforenteringURLparameters.URL的第一件事,你会设置请求。先前使用的URL输入字段存储URL并将显示自动完成下拉当你开场进入你的网址。单击URL参数按钮将翻开键-值编辑器输入URL参数ParametersyouenterintheURLbarorinthekey/valueeditorwillnotautomaticallybeURL-encoded.Rightclickonapieceofselectedte*t,andclickEncodeURIComponenttomanuallyencodetheparametervalue.参数输入地址栏或键/值编辑器不会自动URL编码。右击选中的文本,然后单击EncodeURIComponent手工编码参数值。Youcanindividuallyaddkey/valuepairsandPostmanwillcombineeverythingtogether.IfyourURLalreadyhasparameters-fore*ample,ifyouarepastingaURLfromsomeothersource,PostmanwillsplittheURLintopairsautomatically.您可以单独添加键/值对,postman会结合在一起的一切。如果你的URL已经参数——例如,如果你是粘贴URL从其他来源,postman将URL分成自动配对HeadersClickingontheheaderstogglewillshowtheheaderskey-valueeditor.Youcansetanystringastheheadername.Commonheaderspartofthespecareavailableinanauto-completedropdownwhenyoubegintypingtheheadername.Valuesforthe"Content-Type"headerarealsoavailableinanauto-completedropdown.单击标题切换键值编辑器将显示头。你可以设置任何字符串作为标题名称。常见的标头局部标准在一个自动完成拉当你开场键入标题名称。"内容类型〞头的值也可以自动完成下拉。HeaderpresetsYoucansavecommonlyusedheaderstogetherinaheaderpreset.Youcanaddaheaderpresettoyourrequestbyclickingthe"Addpreset"buttonorbyselectingthepresetfromtheheaderdropdown.您可以保存常用的标题在标题预设。您可以添加一个头预定你的请求通过单击"添加预设〞按钮或通过选择预设的标题下拉MethodChangingthemethodisstraightforward.Justselectthemethodfromtheselectcontrol.Therequestbodyeditorareawillchangedependingonwhetherthemethodcanhaveabodyattachedtoitornot.改变方法很简单。只是选择方法从请求主体的选择控制。编辑器区域将会改变取决于方法可以有身体连接到它。Theabilitytoaddadditionalmethodsandtogglingwhetherabodycanbeattachedtoitwillbeaddedsoon添加额外的方法和切换的能力是否身体可以被附加到它很快就会被添加RequestbodyWhileconstructingrequests,youwouldbedealingwiththerequestbodyeditoralot.Postmanlet'syousendalmostanykindofrequest(Ifyoucan'tsendsomething,letusknow!).Thebodyeditorisdividedinto4areasandhasdifferentcontrolsdependingonthebodytype.而构建请求,您将处理请求主体编辑器。postman让你送几乎任何类型的请求(如果你不能送东西,让我们知道!)。身体编辑分为4个区域,根据身体类型有不同的控制。form-datamultipart/form-dataisthedefaultencodingawebformusestotransferdata.Thissimulatesfillingaformonawebsite,andsubmittingit.Theform-dataeditorletsyousetkey/valuepairs(usingthekey-valueeditor)foryourdata.Youcanattachfilestoakeyaswell.DonotethatduetorestrictionsoftheHTML5spec,filesarenotstoredinhistoryorcollections.Youwouldhavetoselectthefileagainatthetimeofsendingarequest.多局部/格式数据是默认编码一个web表单使用传输数据。这对一个网站模拟填充表单,并提交它。格式数据编辑器允许您设置键/值对(使用键值编辑器)为您的数据,您可以将文件附加到一个关键。做注意,由于HTML5标准的限制,文件不存储在历史或集合。你会选择文件再次发送请求的时候。urlencodedThisencodingisthesameastheoneusedinURLparameters.Youjustneedtoenterkey/valuepairsandPostmanwillencodethekeysandvaluesproperly.Notethatyoucannotuploadfilesthroughthisencodingmode.Theremightbesomeconfusionbetweenform-dataandurlencodedsomakesuretocheckwithyourAPIfirst.这个编码是一样使用的URL参数。你只需要输入键/值对,postman将编码键和值正常。请注意,您不能上传文件通过这个编码模式。可能会有一些混淆格式数据和urlencoded所以一定先检查你的API。rawArawrequestcancontainanything.Postmandoesn'ttouchthestringenteredintheraweditore*ceptreplacingenvironmentvariables.Whateveryouputinthete*tareagetssentwiththerequest.Theraweditorletsyousettheformattingtypealongwiththecorrectheaderthatyoushouldsendwiththerawbody.YoucansettheContent-Typeheadermanuallyaswell.Normally,youwouldbesending*MLorJSONdatahere.原始请求可以包含任何东西。postman不碰在原始编辑器中输入的字符串取代环境变量除外。无论你的文本区域发送请求。原始编辑器允许您设置格式类型以及正确的标题,你应该发送原始的身体。你也可以手动设置content-type头。通常,你会在这里发送*ML或JSON数据。binarybinarydataallowsyoutosendthingswhichyoucannotenterinPostman.Fore*ample,image,audioorvideofiles.Youcansendte*tfilesaswell.Asmentionedearlierintheform-datasection,youwouldhavetoreattachafileifyouareloadingarequestthroughthehistoryorthecollection.二进制数据允许你发送的东西你不能进入postman。例如,图像,音频或视频文件。您可以发送文本文件格式数据节。正如前面提到的,你必须将一个文件加载请求通过历史或集合。WorkingwithresponsesEnsuringthattheAPIresponseiscorrectissomethingthatyouwillbedoingalot.ThePostmanresponseviewerwillmakethistaskmucheasierforyou.确保API的反响是正确的,你会做很多。postman响应查看器将使这项任务变得更简单。AnAPIresponseconsistsofthebody,headersandthestatuscode.Postmanorganizesbodyandheadersindifferenttabs.ThestatuscodewiththetimetakenfortheAPIcallisdisplayedne*ttothetabs.Youcanhoveroverthestatuscodetogetmoredetailsaboutthecode.MostlyitwillbethedefaultdescriptionasmandatedbythespecbutAPIauthorscanalsoaddcustommessages.API的反响包括身体、头和状态码。postman组织体在不同的标签和标题。时间的状态代码旁边的API调用显示选项卡。你可以悬停在状态代码更详细的代码。主要是它将默认API描述标准强制要求的,但作者也可以添加自定义消息。SavingresponsesIfarequesthasbeensavedinacollection,youcansaveresponsesforthatrequest.Oncetheresponsehasbeenreceived,clickthe"Saveresponse"button.You'llbeabletosavetheresponsewithaname.Allresponsessavedforarequestwillbeavailablewheneveryouloadtherequest(abovetherequestURL).如果请求被保存在一个集合,您可以保存响应请求。只有在接收到响应后,单击"保存响应〞按钮。你可以保存响应与一个名字。所有响应保存请求可以无论何时加载请求(在请求URL)。Viewingresponses查看回复ThePostmanbodytabgivesyouseveraltoolstohelpyoumakesenseofthingsquickly.Thebodycanbeviewedinoneofthreeviews-pretty,raw,andpreview.postman身体标签给你一些工具来帮助您理解事情很快。身体可以在三种观点——漂亮,生和预览PrettyTheprettymodeformatsJSONor*MLresponsessothattheyareeasiertolookat.NobodywantstoscrollthroughaminifiedsinglelineJSONresponselookingforthatelusivestring!LinksinsidetheprettymodearehighlightedandclickingonthemcanloadaGETrequestinPostmanwiththelinkURL.Byclickingonthelinenumbersontheleftyoucanfoldlargechunksoftheresponse.ForPostmantoautomaticallyformatthebody,makesuretheappropriateContent-Typeheaderisreturned.IftheAPIdoesnotdothisthenyoucanforceformattingthroughJSONor*ML.Youcanenablethe"ForceJSON"settingaswell.漂亮模式格式JSON或*ML响应,这样他们更容易看。没人想滚动一个缩小的单线JSON响应寻找难以捉摸的字符串!突出漂亮的模式中的链接,点击可以加载一个GET请求的postman链接URL。通过点击左边的行号你可以折叠大量响应。postman自动格式,确保适当的内容类型返回头。如果API不这样做,则你可以迫使通过JSON或*ML格式。您可以启用"JSON力量〞设置。Note:YoucanuseCmd+F/Ctrl+Ftoopenthesearchbar,andCmd+G/Ctrl+Gtoscrollthroughresults.注意:您可以使用Cmd+F/Ctrl+F翻开搜索栏,和Cmd+G/Ctrl+G滚动结果。RawTherawviewisjustabigte*tareawiththeresponsebody.Itcanhelptotellwhetheryourresponseisminifiedornot.原始的观点只是一个大文本区域响应的身体。它可以帮助你判断反响是否缩小。PreviewThepreviewtabrenderstheresponseinasandbo*ediframe.SomewebframeworksbydefaultreturnHTMLerrorsandthepreviewmodeisespeciallyhelpfulthere.Duetoiframesandbo*restrictions,Javascriptandimagesaredisabledintheiframe.preview选项卡呈现响应在沙箱iframe。一些web框架默认返回HTML错误和preview模式尤其有帮助。由于iframe沙箱限制,Javascript和iframe图像被禁用。Youcanma*imizethebodytooccupythewholePostmanwindow.Incase,youplanonspendingalotoftimewiththeresponse,thisisthewaytogo.你可以最大化的身体占据整个postman窗口。在情况下,你方案花费了大量的时间和响应,这是路要走。IfyourAPIendpointreturnsanimage,Postmanwilldetectandrenderitautomatically.Forbinaryresponsetypes,youshouldselect"Sendanddownload"whichwillletyousavetheresponsetoyourharddisk.Youcanthenviewitusingtheappropriateviewer.Thisgivesyouthefle*ibilitytotestaudiofiles,PDFs,zipfilesoranythingthattheAPIthrowsatyou.如果你的API端点返回一个形象,postman将自动检测并呈现它。对于二进制响应类型,你应该选择"发送和下载〞,会让你节省硬盘的响应。然后你可以查看它使用适当的观众。这使您的灵活性来测试音频文件,pdf,zip文件或任何API抛给你。HeadersHeadersaredisplayedaskey/valuepairsintheheadertab.Hoveringovertheheadernamecangiveyouadescriptionoftheheaderaccordingtothespec.IfyouaresendingaHEADrequest,Postmanwillshowtheheaderstabbydefault.标题显示的键/值对标题标签。徘徊在标题的名称可以给你描述标题根据标准。如果你发送HEAD请求,postman将显示默认标题标签。BasicAuthEntertheusernameandpasswordfieldsandhit"Refreshheaders"togeneratetheauthorizationheader.输入用户名和密码字段,并点击"刷新头〞生成授权头。DigestAuthDigestauthismorecomplicatedthanbasicauthandusesthevaluescurrentlysetintherequesttogeneratetheauthorizationheader.Makesuretheyaresetproperlybeforeyougeneratetheheader.Postmanwillremovethee*istingheaderifit'salreadypresent.消化身份验证是更复杂的比根本认证和使用请求中的值目前设置生成授权头。确保他们正确设置之前生成标题。postman会删除现有的头如果它已经存在。Postman'sOAuthhelperlet'syousignrequestswhichsupportOAuth1.0abasedauthentication.Currentlyitdoesnotletyouacquiretheaccesstoken.That'ssomethingyouwouldneedfromtheAPIprovider.TheOAuth1.0helpercansetvaluesineithertheheaderorasqueryparameters.Postman的OAuth助手让你签署请求支持OAuth1.0根底认证。目前它不让你获取访问令牌。这是需要从API提供者。OAuth1.0助手可以在标题或设置值作为查询参数。AssubsequentOAuthrequestsmighte*pectadifferentnoncevalue,PostmancanrefreshtheOAuthsignaturejustbeforetherequestissentifautoaddparametersisenabled.后续的OAuth请求可能认为不同nonce价值,postman可以刷新OAuth签名发送请求之前如果启用了自动添加参数。TheOAuth1.0specisquitecomplicatedandtherearemanyvariations.Postmantriestosupportasmanyofthosevariationsaspossiblebutifsomethingdoesnotworkforyou,pleasefileanissueonGithub.Thesearefewoftheoptionsthatwe'veincluded:OAuth1.0标准非常复杂,有很多变化。postman试图支持尽可能多的这些变化,但如果不为你工作,请在Github文件问题。这些都是一些我们的选项包括:Addemptyparamstosignature-SomeimplementationsofOAuth1.0requireemptyparameterstobeaddedtothesignature.加空参数的签名,有些实现OAuth1.0需要添加到空参数签名。Addparamstoheader-Ifthisisenabled,paramsareaddedtotheheader.Ifnot-theURLparamsforaGETrequest,andtherequestbodyforPOST/PUTrequests参数添加到标题——如果这是启用,参数被添加到标题。如果不是——一个GET请求的URL参数,和POST或PUT请求的请求主体PostmansupportsgettingtheOAuth2.0tokenaswellasaddingittorequestsreallyeasy.TogetanaccesstokenfromanOAuth2.0provider,followthesesteps:Sets://.getpostman./oauth2/callbackasthecallbackURLinyourappsettingspage.GetauthorizationURL,accesstokenURL,clientIDandclientsecretfromyourAPIprovider.YoucanalsosettheScopeparameterwhichisneededbysomeAPIstosetthelevelofaccessyouhavewithintheAPIPressthe"Getaccesstoken"buttontoinitatetheOAuth2.0flow.Ifeverythingissetupproperly,youwouldberedirectedtothePostmanserverwhichwillpickupyouraccesstokenandsendittothePostmanapp.TofinishaddingthetokentoPostman,giveitanamesothatyoucanaccessitquicklylater.Accesstokensarestoredlocallyandwillshowupinthehelperlist.Toaddanaccesstokentotherequest,clickthetokenname.Operationsonfolders/requestsEditingHoveroverthefolder/requestnameinthesidebar,andclicktheedit(pencil)icon.Thiswillallowyoutochangethenameanddescription.NotethatthedescriptionsupportsMarkdown.DuplicatingDuplicatingwillcreateacopyofthefolder/request.Thenewfolder/requestwillbecreatedasasiblingoftheoriginal.DeletingNote:Deletingafolderwilldeleteitsconstituentrequests,anddeletingarequestwilldeleteanyresponsessavedwiththerequest.SharingcollectionsStartingwithPostmanv0.9.3youhavetheabilitytoshareandmanageyourcollectionsmoreeffectively.ThefirstthingyouwillhavetodoiscreateaPostmanaccount.YoucancreateoneusingyouremailIDoraGoogleaccount.Onceyouaresignedinaftercreatinganaccount,thecollectionsyouuploadonPostmanarelinkedtoyouraccount.Youcandeletethemlaterthroughthe"Sharedcollections"iteminthenavigationbardropdown.从postmanv0.9.3你有能力分享并更有效地管理你的集合。你要做的第一件事是创立一个postman账户。您可以创立一个使用你的电子邮件ID或一个谷歌帐户。一旦你在创立一个帐户后,签署您上传的集合postman都与您的帐户。稍后您可以删除它们通过导航栏中的"共享收藏〞项下拉。Thesharedcollectionsmodalalsolet'syouuploadallofyourlocalcollectionswithoneclick.IfyoujustinstalledPostmanonanewmachine,thenyoucandownloadallyourcollectionstoo.共享集合模态也让你上传所有的地方与一个点击收藏。如果你只是postman在新机器上安装,然后你也可以下载你所有的集合。Sharedcollectionsareprivateunlesse*plicitlylabelledpublic.Youcandownloadordeleteindividualcollectionstoo.共享集合是私有,除非显式标签。你也可以下载或删除个人收藏。APIDirectoryThePostmanAPIdirectorygivesyouaccesstopubliccollectionssharedbythePostmancommunity.ThesearestillearlydaysforthedirectorybutthegoalistohavecommonlyusedAPIsavailablehere.DevelopersshouldbeabletogetstartedquicklywithouthavingtorecreaterequeststhroughtheAPIdocumentationorcurldocs.postmanAPI目录给你访问公共集合由postman共享社区。这些仍在早期的目录,但目标是常用的API。开发人员应该能够开场快速而无需重新创立请求通过API文档或文档的旋度。EnvironmentsWhileworkingwithAPIs,youwilloftenneedtohavedifferentsetups.Fore*ample,yourlocalmachine,thedevelopmentserver,ortheproductionAPI.Environmentsgiveyoutheabilitytocustomizerequestsusingvariables.Thiswayyoucaneasilyswitchbetweendifferentsetupswithoutchangingyourrequests.Youwon'thavetoworryaboutrememberingallthosevaluesoncetheyareinPostman.EnvironmentscanbedownloadedandsavedasJSONfilesanduploadedlater.使用API时,您通常会需要不同的设置,例如,你的本地机器,开发效劳器,或者生产API。环境使您能够定制请求使用变量。这样你可以很容易地切换不同的设置没有改变你的请求。你不必担忧记住所有这些值一旦postman。环境中可以下载并保存为JSON文件,稍后上传。Eachenvironmentisasetofkey-valuepairs.Thesecanbeeditedusingthekey-valueeditor.Theykeyisthevariablename.每个环境是一组键值对。这些可以使用键值编辑器编辑。关键是变量名。Variablescanbeus
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年急救急诊专科护士考核试题及标准答案大全
- 2026年驻马店职业技术学院单招综合素质考试题库含答案详解(满分必刷)
- 2025-2026学年幼儿园过年教案
- 2025-2026学年家的拼音教学设计模板
- 2026年长沙电力职业技术学院单招职业技能考试题库带答案详解(典型题)
- 2026年青岛工程职业学院单招职业技能考试题库含答案详解(综合卷)
- 2026年阿勒泰职业技术学院单招职业适应性测试题库(含答案详解)
- 2026年青岛黄海学院单招职业技能考试题库附参考答案详解(b卷)
- 2026年青海柴达木职业技术学院单招职业适应性考试题库含答案详解(精练)
- 2025-2026学年廉颇教学设计与指导教师
- 半导体器件制程良率提升考核试卷
- 2024版《53积累与默写及期末知识复习卷》3年级语文下册(人教RJ)附参考答案
- 消防设备维修协议
- CNC加工中心程序代码大全
- JTG D50-2017公路沥青路面设计规范
- CJJT 29-2010 建筑排水塑料管道工程技术规程
- 慢性肾脏病5期饮食宣教
- CNC车床安全技术操作规程
- 人工智能的知识表示与推理
- 社区健康服务与管理
- 杨胜刚版国际金融第一章课件
评论
0/150
提交评论