DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Migrate, Modernize and Build Java Web Apps on Azure: This live workshop will cover methods to enhance Java application development workflow.

Modern Digital Website Security: Prepare to face any form of malicious web activity and enable your sites to optimally serve your customers.

Kubernetes in the Enterprise: The latest expert insights on scaling, serverless, Kubernetes-powered AI, cluster security, FinOps, and more.

E-Commerce Development Essentials: Considering starting or working on an e-commerce business? Learn how to create a backend that scales.

Related

  • AWS Serverless Lambda Resiliency: Part 1
  • Rocket.rs API Demo Implementing Header-Based API Key Protection
  • REST APIs: Simplicity, Flexibility, and Adoption
  • API Testing With Cypress

Trending

  • Architecture Patterns: API Gateway
  • Building a Real-Time Slackbot With Generative AI
  • A Deep Dive Into Different Types of Caching in Presto
  • Mastering Backpressure in Java: Concepts, Real-World Examples, and Implementation
  1. DZone
  2. Data Engineering
  3. Databases
  4. Try Out the Stream API With Postman

Try Out the Stream API With Postman

Postman is a useful web dev tool with some great new features for bundling API requests. Here's a new Postman collection from the developers at Stream.

Dwight Gunning user avatar by
Dwight Gunning
·
May. 28, 18 · Tutorial
Like (1)
Save
Tweet
Share
17.8K Views

Join the DZone community and get the full member experience.

Join For Free

As many developers are aware, Postman is a fantastic tool for developing and testing RESTful web services and APIs. Since its inception, Postman has evolved beyond simply sending HTTP requests into a feature-rich product with support for automated testing and team collaboration.

Many of us at Stream use Postman regularly as we build and test our services. We're also always looking for ways to make it quick and easy for other developers to try the service. One of our goals is to help people see first hand how simple it is to build powerful social apps with Stream.

When we realized that Postman's newest features provide an opportunity to bundle API request examples, and perform more advanced steps like generating JSON Web Tokens (JWTs) for each request, we were keen to give it a shot with Stream. We're now happy to publish a Postman collection that demonstrates all of the RESTful API endpoints to the Stream service.

Image titleThe Stream API Postman Collection

The Stream API Postman Collection

Those who're itching to try it out can head to the Stream documentation and download the collection.

If you'd like to learn a little more about what's in the collection and how we built it, read on.

What's in the Collection

The collection contains around 30 requests that demonstrate all of Stream's major features as well as the individual API calls that correspond to each step in our Getting Started tutorial. This covers adding and modifying activities, retrieving feeds, and maintaining the follower relationships in order to maintain the social graph within an application. This will no doubt broaden even further as we add new API endpoints and expanded features.

One challenge we faced in building the collection was setting up an authentication mechanism to ensure Stream would accept and process the requests initiated by Postman. Although Postman supports several common authentication mechanisms like HTTP Basic Authentication, OAuth, and Bearer Tokens, it lacks built-in support for generating the JWTs that Stream makes use of. Thanks to another helpful Postman feature called Pre-request Scripts, we were presented with an elegant solution. For the Stream requests, a simple custom JavaScript program first generates a JWT and populates the HTTP request header on each request.

Image title

The Collection-level Pre-request script generates a JSON web token for authentication.

As with all but the most non-trivial APIs, each request includes dynamic data and parameters that relate to the resource and/or operation being requested. Configuration and 'secrets' for authentication purposes are also needed. To avoid unnecessary setup steps, we embed appropriate configuration for a "starter" app. This configuration can be updated later via Postman's environment variables.

Finally, we wanted to not only demonstrate the requests but also help developers begin to understand how they themselves can work with the Stream service. With Postman's focus on quality API documentation, we were able to include explanations of each resource URL fragment, HTTP header, and the request body (JSON payloads) that are sent. This includes the optional parameters and references to our online API Documentation where more guidance on advanced use cases can be found.

Image titleDescriptions are provided for URL query string parameters, body fields, and HTTP headers.

Descriptions are provided for URL query string parameters, body fields, and HTTP headers.

Wrapping Up

If you're interested in the running the Postman Collection, head over to the Stream documentation to download the collection. Fire up Postman and following the README instructions. Don't forget to star us and feel free to raise issues or submit pull requests if you see any areas for improvement.

This is our first attempt at packaging and sharing a Postman Collection so we're curious what you think. Chime in on Twitter or shoot us an email at with your thoughts.

API Stream (computing) Requests

Published at DZone with permission of Dwight Gunning, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • AWS Serverless Lambda Resiliency: Part 1
  • Rocket.rs API Demo Implementing Header-Based API Key Protection
  • REST APIs: Simplicity, Flexibility, and Adoption
  • API Testing With Cypress

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: