Do you think IIT Guwahati certified course can help you in your career?
No
Introduction🗒️
Postman supports API-first development with API Builder. We can build our API directly in Postman with the help of API Builder. We can also connect different elements of our API testing and development process to our schemas, like documentation, collections, mocks, test, and monitors. We can also version our APIs in Postman and connect elements to specific versions and releases.
The postman API endpoints allow us to integrate Postman within our development toolchain. We can add new collections, update environments, update existing collections, and add and run monitors directly through the API. This article will discuss creating and importing API in Postman, so stay till the end.
Creating an API🎯
To begin with API Builder, we can create a new API in our workspace. We can also rename or delete existing APIs. So, let’s look at the steps to create an API.
✍️Step 1: From the sidebar in your workspace, select APIs. We can open and then edit any existing APIs from here.
✍️ Step 2: Select New; then, select API or +.
You must be signed in to your account for performing this action.
✍️ Step 3: Enter a name and a version, then choose a schema type and format for our API. Postman will occupy our API with a sample specification we can edit anytime.
Points to be Noted:
♦️ Schemas current;y supported by Postman are OpenAPI (versions 1.0,2.0,3.0, and 3.1) , RAML (0.8 and 1.0), GraphQL, or WSDL(1.1 and 2.0) schemas.
♦️ OpenAPI schemas can be specified in YAML or JSON.
♦️ AML schemas must be YAML.
♦️ GraphQL schemas can be GraphQL SDL or JSON.
♦️ WSDL schemas must be XML.
♦️ Multiple variants of schemas are not supported currently.
We can rather select the Import tab to import API specifications directly from a local directory, a Bitbucket or a Github repository, or an Amazon API Gateway. For more information on importing an API specification, we can see Importing an API.
✍️ Step 3: Now, Select create API.
Renaming and deleting APIs📗
We can rename, remove, or delete the API from the workspace with the help of more action icons … in the sidebar.
When we delete an API or remove it from our workspace, monitors, collections, and environments like it won’t be removed or deleted. Also, any configured integrations are not deleted.
Importing an API 📙
We can import an existing API schema into our API. API schemas can be imported from a local directory or file, a URL, raw text, a code repository, or an API gateway.
🎯Importing API schemas
For importing our API specifications into Postman:
🌀 From the sidebar in our workspace, Select APIs and then select Import.
🌀Select a file or folder, or we can enter the link to the API or paste our raw text.
Note: We can also import from a code repository or API gateway. For details, stay in this article till the end.
🌀 Next, Confirm the name, format, and what we would like our data to import.
Select ImportImport to bring our data into Postman.
We can configure our import settings, Which will change depending on our API specifications.
We can import different API specifications files at once. For this, we need to select the workspace we would like to import the APIs into, choose whether we want to generate collections from the APIs, configure the details, or choose ImportImport.
Importing API schemas from Github📙
We must sign in to a Postman account to use this feature.
We can import API schemas from a Bitbucket repo.
🧵From the side, select APIs, then select ImportImport.
🧵Select Code repository, select Bitbucket.
🧵Verify our GitHub account and Authorize postman abs to access our repos.
🧵Select our GitHub organization, branch, and repository, then select Continue.
🧵Confirm the API schemas we would like to import into Postman. We can also select “Generate collection” from imported APIs and choose what we would like to link this collection as. Select Show advanced settings to control how Postman will generate collections based on our file types, then select Import.
We will receive a confirmation once the ImportImport is complete, and we can view our imported API schemas and generated collections in Postman.
Importing API schemas from Bitbucket📙
We must sign in to the Postman account to use this feature.
We can import API schemas from a Bitbucket repo.
✨From the sidebar in our workspace, select APIs, then ImportImport.
✨Click on Code repository, then click on ImportImport.
✨Confirm Bitbucket account and Authorize Postman to access repository.
✨Then, in Postman, choose Bitbucket workspace, branch, and repo, then click on Continue.
✨Then, Postman displays a preview of the API schemas to import into our workspace. Then, Click on Import to confirm and complete the ImportImport.
We will receive a confirmation message once the ImportImport is done, and we can view our imported API schemas and generated collections.
Importing API schemas from Amazon API Gateway📗
The steps to import an API from AWS API Gateway are as follows:
From the sidebar, Click on APIs, then Click on Import.
Then, Select API Gateway, then click on AWS API Gateway.
Connect to the AWS API Gateway as given below.
While importing an API from AWS API Gateway, we have two options to authenticate:
Creating an AWS IAM role
Using an AWS access key
Authenticating with an AWS IAM role📘
🎯Select IAM under the AWS Authentication Mechanism section.
🎯Choose the AWS API Type (REST or HTTP).
🎯Next, in AWS, create an IAM role for Postman:
🧿 Open the AWS IAM console and click on create the Role.
🧿 Select Another AWS account under the SELECT type of trusted entity section.
🧿 Then enter AWS Account ID of Postman: 258201882842
🧿 Choose the check box to Require external ID and enter the External ID.
We can get the external ID under Step1: Create an IAM role.
🧿 Choose Next: Permissions.
🧿 We can select an existing IAM policy or choose to Create a policy.
If we are creating a policy, we need to use the following JSON code:
This will enable deploying and exporting HTTP API schemas. We can also customize the Action section in the IAM policy:
“Apigateway: GET”
It enables viewing API Gateway deployments for REST and HTTP APIs in Postman.
“Apigateway: PUT”
This enables exporting HTTP API schemas to the API Gateway.
“Apigateway: POST”
This enables the deployment of HTTP API schemas to a stage on the API Gateway.
“Apigateway: * ”
This assigns all GET, POST, PUT, DELETE, and PATCH permissions to the IAM role.
“cloudwatch: GetMetricData”
“cloudwatch: GetMetricData”: This enables viewing CloudWatch metrics in Postman.
🧿Select Next: Tags.
🧿Choose Next: Review.
🧿Add a Role name and description, then click Create Role.
From AWS, copy the Role ARN and post it in Postman under Step 2:
Enter role region and ARN.
Enter the AWS region where the API gateway is located and choose the API Gateway.
Enter an API Name for the imported API.
When we are ready, Choose Connect.
Authenticating with an AWS access key📘
For setting up a connection to Amazon API Gateway with the help of the AWS access key, select Access Key under AWS Authentication Mechanism.
After this, Fill in the information about the connection:
🧿 Select the AWS API Type (REST or HTTP).
🧿 Then, Secret Access Key and Fill in Access Key ID for the AWS account.
🧿 Enter the AWS Region where the API Gateway is placed and choose the API Gateway.
🧿 Now, enter an API Name for the imported API.
When we are read, select ImportImport. After importing our API schema, we can view API deployments in Postman.
Frequently Asked Questions
What is a postman?
Postman is an API client allowing developers to create quickly, share, test, and document APIs. This is accomplished by allowing users to create, save, and read simple and complex HTTP/s requests.
What is API in Postman?
The API in Postman enables you to integrate Postman within our development toolchain.
How do I hit API with Postman?
The simplest way to get started with the API is to select the fork button to fork this collection to our own workspace and use Postman to send requests.
Is postman a free software to use?
Sending requests and reviewing answers, building and mocking APIs, testing APIs, monitoring APIs, and many other functions are also available in the free version.
Explain Postman as a testing tool.
An extensive API testing tool that Postman provides makes it simple to put up automated tests. The tests and requests you have made can be combined into a single automatic test sequence.
What is the purpose of using postman?
Developers can easily create, share, test, and document APIs with Postman, an API client. Users are given the ability to generate, store, and read both simple and complicated HTTP/s requests as well as their responses to achieve this.
Conclusion
In this article, we have discussed how to develop an API in Postman. We started with the introduction of Postman, creating an API, Renaming and deleting APIs, Importing an API, Importing API schemas from Github, Importing API schemas from Bitbucket, and importing API schemas from Amazon API Gateway.