Now that you have installed the Postman application, it's time to download and import in the Click2Mail examples to better understand how to use the API.
Postman workspaces have a variety of sections. The three that we will be concerned with are:
- Global Variables
Batch API will be covered in a guide coming soon.
Each of these sections are imported separately from .json files. You can download the current version of the Click2Mail example import files from github at:
Download and unzip the github files, then return to the Postman application. Under My Workspace, click the Import button on the left side of the window:
Click Upload Files, select all four .json files (ignore readme.md), and click Open. Postman should present a window confirming the files and the section they will go into:
Verify that you have two Collection, one Globals, and one Environment file, and click Import. Once the import completes, you should see the C2M REST APIs collection under My Workspace on the left. If you expand the collection, you'll see all of the endpoint examples:
To add your staging user credentials into Postman, you'll set them as environment variables. To do this, go to Environments and select stage_user. On the right, replace the CURRENT VALUE of username and password with your actual staging username and password. If you would like that information to persist between sessions, you can click the Save button. Otherwise you'll need to reenter the credentials each time you start Postman.
To test your set up, we'll check the credit balance on your account. On left side, select Collections, and expand Credit until you see /molpro/credit, and select it. Then in the upper right, click the dropdown beside "No Environment" and pick "stage_user".
Now click "Send", and you should get your credit balance returned as XML in the Response section at the bottom.
You're all set! Postman is up and working! There are numerous examples in the collection, demonstrating the use of the various endpoints and their parameters. You can add to them, edit them, and in general play around with the calls. The Response section will show you a lot of detail about what you get back from the call. Postman is a great tool for testing out calls without having to worry about the overhead of coding them.
Updated 8 months ago