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 hundreds 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, headers, 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, authorization credentials, 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.

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.

3. Enter headers in case they are required.

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.

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.

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.

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.

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

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 Manage environments. You will be able to add a new one as well as its respective variables.

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.

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

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的更多相关文章

  1. Postman(API & HTTP请求调试插件)

    简述 Postman是一个Chrome扩展,提供功能强大的Web API & HTTP请求调试.它能够发送任何类型的HTTP 请求(GET.HEAD.POST.PUT..),附带任何数量的参数 ...

  2. Improve Scalability With New Thread Pool APIs

    Pooled Threads Improve Scalability With New Thread Pool APIs Robert Saccone Portions of this article ...

  3. SAP CRM 最新简介文字(2007年、中英文)

    以下内容是SAP CRM功能的精简描述,摘自SAP官方文档,附上中英文版本,可以对SAP CRM的主要功能有大致了解. 营销 - 使用营销资源管理.客户细分及列表管理.营销活动管理.线索管理.贸易促销 ...

  4. 10分钟入门spark

    Spark是硅谷各大公司都在使用的当红炸子鸡,而且有愈来愈热的趋势,所以大家很有必要了解学习这门技术.本文其实是笔者深入浅出hadoop系列的第三篇,标题里把hadoop去掉了因为spark可以不依赖 ...

  5. cloudera-scm-server启动时出现Caused by: java.io.FileNotFoundException: /var/lib/cloudera-scm-server/.keystore (No such file or directory)问题解决方法(图文详解)

    不多说,直接上干货! 问题详情 查看/var/log/cloudera-scm-server.log的启动日志 问题来源 我在用cloudermanager安装好之后,然后,在对如下. 配置kerbe ...

  6. Network Function Virtualization for a Network Device

    An apparatus for performing network function virtualization (NFV), comprising: a memory, a processor ...

  7. 定位和xml解析和gson解析加上拉加载,下拉刷新

    这里的上拉加载,下拉刷新用到是依赖包 Mainactivity,xml解析和定位 package com.exmple.autolayout; import java.util.List; impor ...

  8. 浅谈HTTP中GET、POST用法以及它们的区别

    浅谈HTTP中GET.POST用法以及它们的区别 HTTP定义了与服务器交互的不同方法,最基本的方法有4种,分别是GET,POST,PUT,DELETE.URL全称是资源描述符.我们可以这样认为: 一 ...

  9. [转]浅谈HTTP中GET、POST用法以及它们的区别

    HTTP定义了与服务器交互的不同方法,最基本的方法有4种,分别是GET,POST,PUT,DELETE.URL全称是资源描述符.我们可以这样认为: 一个URL地址,它用于描述一个网络上的资源,而HTT ...

随机推荐

  1. C# 把字符串中间的多个连续的空格转化成一个空格

    今天在弄帮客户将txt文件中的信息导入到数据库中,遇到了这个问题.因为客户的txt文件中两个字符串之间的空格数量不确定,没有办法使用split函数来分割,最后想到的办法是,将连续的空格转成一个空格,然 ...

  2. ZeroClipboard插件——复制到剪切板

    ZeroClipboard是一个轻量级的jQuery“复制到剪贴板”插件采用了时下流行的零剪贴板库.官网:http://www.steamdev.com/zclip 参数及默认值path(必选)  Z ...

  3. [转]iOS证书(.p12)和描述文件(.mobileprovision)申请

    转载于:http://ask.dcloud.net.cn/article/152 iOS有两种证书和描述文件: 证书类型 使用场景 开发(Development)证书和描述文件 用于开发测试,在HBu ...

  4. 【QT学习】QT GUI应用程序的框架,文件分析

    有几个名字,项目名,类名,界面对象名. 1.项目文件 项目名.pro(MyHelloQt.pro) 主要包括项目用到的模块,项目包含哪些源码文件,头文件,窗体文件,生成应用程序的名称. 由QT自动生成 ...

  5. (IRCNN)Learning Deep CNN Denoiser Prior for Image Restoration-Kai Zhang

    学习深度CNN去噪先验用于图像恢复(Learning Deep CNN Denoiser Prior for Image Restoration)-Kai Zhang 代码:https://githu ...

  6. 如果你的eclipse在每次run或debug时都莫名其妙的做一件事

    新项目,使用Ant打war包.结果写完了Ant以后,包是打好了,却使eclipse以后每次run或debug时都莫名其妙地自动先执行这个Ant, 让人十分苦恼. 其实,是你的eclipse设置出了问题 ...

  7. IT建设如何面对“短板”和“孤峰”?

    在与很多企业探讨信息化建设时,很多IT负责人都提出过一个问题,企业信息化建设的资源是有限的,信息化的资源是先强化企业的“孤峰”还是先支持“短板”?   企 业虽说是一个整体,但不同的领域如研发.生产. ...

  8. mysql中json_extract函数的使用?作用是什么?

    需求描述: 今天看mysql中的json数据类型,涉及到一些使用,使用到了函数json_extract来 获取json字段中某个key的值,在此记录下. 操作过程: 1.查看包含json字段的表信息 ...

  9. nginx 配置虚拟主机的三种方法

    nginx,一个server标签就是一个虚拟主机. 1.基于域名的虚拟主机,通过域名来区分虚拟主机——应用:外部网站 2.基于端口的虚拟主机,通过端口来区分虚拟主机——应用:公司内部网站,外部网站的管 ...

  10. Extjs表单验证小结

    //放在onReady的function(){}中 Ext.QuickTips.init(); //为组件提供提示信息功能,form的主要提示信息就是客户端验证的错误信息. Ext.form.Fiel ...