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.
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.
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.
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.
Descriptions are provided for URL query string parameters, body fields, and HTTP headers.
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.
Published at DZone with permission of Dwight Gunning, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.