Reviews

Postman common functions. Filtering and Sorting APIs Using the Postman API

Postman download exe

Filtering and sorting APIs using the Postman API gives you the ability to decide which APIs you want to retrieve and how to organize them. You can easily apply a combination of filters using HTTP query parameters on the Postman API “Get all APIs” request. For instance, you can retrieve all the public APIs that have been updated during a specific time interval. With sorting, you can define which field you want to sort by and the sorting direction. By combining filtering and sorting, you can obtain the filtered list of APIs showing the most recently updated APIs first.

Even though filtering APIs by workspace was already possible, we eventually added the ability to filter by most other fields. Sorting, on the other hand, is a totally new feature that opens new possibilities. Together, filtering and sorting let you access your APIs in ways that make more sense to your particular use case.

With this latest feature, Ohpen, one of Postman’s customers, improved an internal tool to share and document OpenAPI specifications. “Being able to filter and sort the APIs during retrieval help us provide the best user experience to all API consumers when they are looking for a specific schema” says Fabrizio Ferri Benedetti, lead technical writer at Ohpen.

Online Postman API test

Keep reading to know more about how filtering and sorting work.

How to filter your APIs

Filtering works by reading the value of a parameter and applying it as the filter to the corresponding response field. If you employ more than one parameter, the filtering will be done using a logic AND on the combination of parameters. To get all the public APIs that have been updated during a specific time interval you would GET /apis?isPublic=true&since=2020-01-01T00:00:00+01:00&until=2020-02-01T00:00:00+01:00. Here are all the parameters that we’re adding that you can use to create your own filtering combinations:

  Postman common functions. How to Reverse an Audio Clip in Adobe Audition
Name Description Example
since Only return APIs that have been updated after this time. Time is represented using the ISO 8601 date and time format. /apis?since=2020-01-01T00:00:00+01:00
until Only return APIs that have been updated before this time. Time is represented using the ISO 8601 date and time format. /apis?until=2020-01-01T00:00:00+01:00
createdBy Only return APIs that have been created by the user ID represented by the given value. /apis?createdBy=28613
updatedBy Only return APIs that have been updated by the user ID represented by the given value. /apis?updatedBy=42847
isPublic Only return APIs with the corresponding privacy state. Public APIs have the isPublic value true; private APIs have the isPublic value false. /apis?isPublic=true
name Only return APIs whose name includes the given value. Matching is case insensitive. /apis?name=example
summary Only return APIs whose summary includes the given value. Matching is case insensitive. /apis?summary=example
description Only return APIs whose description includes the given value. Matching is case insensitive. /apis?description=example

How to sort your APIs

Sorting works by reading the value of a parameter that defines which field is used to sort the results. The value of another parameter defines the sorting direction that can be ascending or descending. Unlike filtering, where you can combine multiple parameters, sorting is limited to a single parameter at a time. You can, however, combine filtering and sorting to retrieve the results. To retrieve the list of public APIs that have been updated during a specific time interval, showing the most recently updated first, you would GET /apis?isPublic=true&since=2020-01-01T00:00:00+01:00&sort=updatedAt. These are the parameters that let you control how you want the sorting feature to behave:

Name Description Example
sort The value of sort can be one of the names of the fields included in the response. /apis?sort=updatedAt
direction The sorting direction, which can be ascending or descending. The value can be asc to specify an ascending direction or desc to specify a descending direction. If none is specified, the default sorting direction is descending for timestamp and numeric fields and ascending otherwise. An ID is not considered a numeric field. /apis?sort=updatedAt&direction=asc
  Postman common functions. Facebook Messenger Receives Thousands Of One Star Reviews‏

Try it yourself

We’ve added the ability to filter and sort APIs using the Postman API /apis endpoint. Filtering works by using a combination of GET parameters, one for each field that you want to sort by. You can specify sorting for a single field at a time, and you can choose to use an ascending or descending direction. By combining filtering and sorting, you’ll be able to fine-tune the way you retrieve APIs and offer the best experience to your own users. You can try it yourself by opening the “Get all APIs” request and fine-tune it to your needs.

Postman provides a wide range of functions and features to assist with API development, testing, and collaboration. Here are some commonly used functions in Postman:

  • Creating and Managing Requests: Postman allows you to create API requests by specifying the request method, URL, headers, parameters, and body. You can manage and organize requests within collections, including creating folders, adding descriptions, and reordering requests.

  • Request and Response Visualization: Postman provides a user-friendly interface to view and analyze request and response data. It supports syntax highlighting for various data formats such as JSON, XML, and HTML, making it easier to understand and validate the data.

  • Environment and Variables: Postman allows you to define variables and environments. Variables enable you to store and reuse dynamic values across requests, making them flexible and easy to maintain. Environments provide sets of variables specific to different environments (e.g., development, staging, production).

  • Tests and Assertions: Postman supports writing test scripts using JavaScript for automated API testing. You can write assertions to validate response status codes, headers, response bodies, and more. Postman's testing framework allows you to assert and validate different aspects of API responses.

  • Pre-request Scripts: Postman enables you to execute scripts before sending API requests using pre-request scripts. These scripts can be used to dynamically generate values, manipulate data, or set variables based on specific conditions.

  • Collection Runner: The Collection Runner allows you to execute a series of requests in a collection. It enables you to perform data-driven testing by iterating over multiple sets of data or environments. You can configure iterations, delays, and data sources for more comprehensive testing.

  • Mock Servers: Postman allows you to create mock servers for simulating API responses without a live backend. Mock servers are useful during development, allowing frontend developers to work independently by providing simulated API responses.

  • Documentation Generation: Postman can automatically generate documentation for your APIs based on your requests and collections. It provides a simple way to share API specifications and details with stakeholders.

  • Collaboration and Teamwork: Postman offers collaboration features such as sharing collections, collaborating on requests, and commenting on specific requests or collections. It also supports version control integration to manage changes and updates effectively.

  • Integration and Automation: Postman integrates with various tools and services, including version control systems (e.g., Git), CI/CD platforms (e.g., Jenkins), and API management solutions. It provides options for integrating with these tools to automate API testing and deployment processes.

  Postman common functions. Pinterest Accidentally Sends Marriage Congratulations to Singles

Leave a Reply