程序笔记   发布时间:2022-05-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了How to Use Postman to Manage and Execute Your APIs大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

How to Use Postman to Manage and Execute Your APIs

Postman is convenIEnt for execuTing APIs because once you’ve entered and saved them,you can use them over and over again without having to remember exact information.

 
Build APIs from sql and Nosql or SALEsforce data sources in seconds. read the CreaTing REST APIs white paper,brought to you in partnership with CA Technologies.

In today’s development world,the importance of APIs is kNown to almost all.

APIs make it possible for any two separate applications to transfer and share data between themselves and makes it easIEr for an application user to execute actions without having to use the application’s GUI. From the developer's POV,it's an easy way to execute certain functionalitIEs of their app and test it,as well.

Using APIs on a daily basis might become cumbersome,as one might have doZens or even @R_313_4892@ of APIs that need to be tested. That makes it difficult to keep up with their exact request’s address,headers,authorization credentials,etc.,and that makes it harder to test the API for functionality,security,and exception handling. 

Postman is a popular API clIEnt that makes it easy for developers to create,share,test,and document APIs. This is done by allowing users to create and save simple and complex http/s requests,as well as read their responses. The result is more efficIEnt and less tedious work.

In this post,we will go over how to use Postman to execute APIs for your daily work,an ability that is available in their free version. We will also show you how to use Postman when using CA BlazeMeter.

In case you don’t have Postman installed,you’ll need Google Chrome browser and to install the Postman chrome extension on Chrome Web Store.

How to Use Postman to Execute APIs

Postman is very convenIEnt when it comes to execuTing APIs,since once you’ve entered and saved them,you can simply use them over and over again without having to remember the exact endpoint,API key,etc.

StarTing with Postman is pretty sTraightforWARD. Go to your and SELEct the Postman logo. you will see Postman’s GUI,and in the upper section,you should see the relevant fIEld to enter your API request as well as the Methods menu (GET,POST,etc.) and tabs to add headers,body,and pre-request scripts. On the right sIDe,you will see the Save button to save your API for future use.

Here is a detailed example explaining how to enter a new API request using CA BlazeMeter’s test create API,but you can do this for the product you are develoPing.

1. Enter the API endpoint where it says Enter request URL and SELEct the method (the action typE) on the left of that fIEld. The default method is GET but we will use POST in the example below.

How to Use Postman to Manage and Execute Your APIs

2. Add authorization tokens and credentials according to the server sIDe requirements. The different methods and protocols that Postman supports are No Authentication,Basic Authentication (provIDe username and password only),Digest Authentication,OAuth 1.0,OAuth 2.0,Hawk Authentication,and AWS Signature.

How to Use Postman to Manage and Execute Your APIs

3. Enter headers in case they are required.

How to Use Postman to Manage and Execute Your APIs

4. Enter a post body in case it is required. In this example,we are creaTing a CA BlazeMeter test that requires a JsON payload with relevant details.

How to Use Postman to Manage and Execute Your APIs

5. If you wish to execute this API Now,hit the Send button,which is located to the right of the API request fIEld. You can also click on the Save button besIDe it to save that API request to your library.

How to Use Postman to Manage and Execute Your APIs

That’s it! Now,you kNow how to enter your API request to Postman and save it to your library.

One of Postman’s fantastic features is Collections. Collections allow you to group together several APIs that might be related or perhaps should be executed in a certain sequence.

For example,in the screenshot below,you can see a collection that includes four APIs that are all required to create and run a CA BlazeMeter test. The first two APIs create the test object — the first of the two applIEs the necessary configuration,and the following API uploads the script file needed to run it. The last two APIs start and stop the test we created prevIoUsly. ObvIoUsly,they should be executed in that sequence,hence the collection will be sorted accordingly.

How to Use Postman to Manage and Execute Your APIs

Running a Postman Collection

In order to run a Postman Collection,you will need to use a feature called Collection Runner.

1. In Postman GUI,in the top left corner of the screen,click the Runner button.

How to Use Postman to Manage and Execute Your APIs

2. SELEct the relevant Collection. In our case,it will be the one called BlazeMeter API.

How to Use Postman to Manage and Execute Your APIs

3. There are additional configuration parameters which you may define but it’s not mandatory. For example,you can specify the number of iterations you wish to run the collection for,as well as add delays between each API request.

Also,there is an option to choose your environment. Environments allow you customize requests using variables that might include environment specific values. This is extremely Helpful in case you are tesTing against several environments such as development environment,production environment,etc. In order to set up a new environment,click on the gear icon on the top right sIDe of the Postman GUI. SELEct @H_323_35@manage environments. you will be able to add a new one as well as its respective variables.

How to Use Postman to Manage and Execute Your APIs

How Postman Helps You Use APIs Within Your Own App or Script

Postman also has a feature called Snippets. By using it,you can generate code snippets in a varIEty of languages and frameworks such as Java,Python,C,cURL,and many others. This is a huge tim- saver since a developer can easily integrate APIs with his or her own code without too much hassle. To use it,click on the Code link below the Save button on the top right section of Postman’s GUI.

How to Use Postman to Manage and Execute Your APIs

Below is an example for our Create Test API in a python snippet.

How to Use Postman to Manage and Execute Your APIs

Congratulations — Now you can Now start running and tesTing your API using Postman!

转自:https://dzone.com/articles/how-to-use-postman-to-manage-and-execute-your-APIs

大佬总结

以上是大佬教程为你收集整理的How to Use Postman to Manage and Execute Your APIs全部内容,希望文章能够帮你解决How to Use Postman to Manage and Execute Your APIs所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:andHowtoYour