How to: Import Postman Web API Printing Requests

In this article

Sample JSON file for import

Importing a request collection

Handling variables in a collection

Postman is a powerful tool for testing and managing API requests.

This article explains, step-by-step, how to import a request collection into Postman and how to handle variables within that collection. This is particularly useful for working with Hardware Station Printing Web API, where you might need to repeatedly send requests to various printing endpoints.

Sample JSON file for import

Below is an example of what your JSON file might look like. Click here to download the file containing the requests to the various printing endpoints.

Importing a request collection

Importing a request collection into Postman allows you to quickly set up and start testing your API endpoints. Follow these steps to import your collection file:

  1. Launch Postman on your computer.
  2. You might need to create a Postman account, if you do not already have one. If that is the case, you must click the orange Create Account button in the top-right corner.
  3. In the top-left corner, click the Import button.
  4. Once you see the below window, you can upload your file by simply dragging and dropping it inside the box. Alternatively, you can import it manually by choosing the path where the file is located.

  5. After selecting your file, click the Import button. The collection is added to your workspace under the Collections tab.

Handling variables in a collection

After importing your collection, it is important to know how to handle the existing variables. These variables make your requests dynamic and customizable.

  1. Once you click the collection name you just added, you see this screen:

  2. In the collection editor, go to the Variables tab. Here, you see the predefined variables.
  3. To change the value of a variable, simply click the Current Value field, and enter the new value.
  4. These variables can be referenced in your requests using double curly braces. For example:
    • URL: '{{HWST_Host}}:{{HWTS_Port}}/api/printer'
    • Body: '{"PrinterConfig":{ "DeviceID": "{{VirtualPrinterID}}, "DeviceHost": "{{HWST_Host}}:{{HWTS_Port}}"}}'