Using Postman to Create TrackVia Snippets

Postman is an excellent tool for API development and TrackVia now maintains an official Postman collection for its OpenAPI. One of its most useful but less obvious features is its ability to convert a configured request, into a snippet, in a variety of different programming languages. This snippet generator makes it easy to bring a working Postman requests into a codebase. Consider the follow scenario where an admin is using C# with the RestSharp DLL to make a call to fetch records in a view. To begin, download Postman and import the TrackVia Postman Collection here.

By default, the TrackVia Postman collection is configured to work with several environment variables. This is a powerful tool for quickly switching sets of credentials and other high level data points often present in network request configurations. More information about managing environments can be found in the Postman documentation here. Below is an example of configuring the TrackViaHost variable. The other two variables used by default are UserKey and AccessToken both of which can be found in the API Access screen under My Account.

Once these environment variables are set or the Postman request has been correctly configured, the snippet generator can be used to produce boilerplate code. On the far right gutter menu, open the snippet tool through this icon.

The menu expands and offers a dropdown with a wide variety of common languages and modules/packages for making network requests. In this example, the C# RestSharp can be selected from the dropdown menu and the snippet will be generated to match the network request currently open in Postman. For additional configuration the gear icon can be accessed which will open a menu of additional supported parameters.

Other supported languages in Python, PHP, Node.js, and cURL.