## Surefire Postman This is a collection of Surefire Platform API requests that can be used with [Postman](https://www.postman.com/). Please update [this repository](https://bitbucket.org/surepulse/surefire-postman/src/master/) when you add or change an api endpoint. ### Installation Open Postman and import [surefire.postman_collection.json](https://bitbucket.org/surepulse/surefire-postman/src/master/surefire.postman_collection.json). This collection contains a number of _collection variables_ that can be modified by clicking `Edit > Variables`. As convenience, some _collection variables_ will be populated automatically by triggering a specific endpoint. For example, the `Login` request may retrieve and update the `token` configuration variable. ### Collection Variables In most cases, these are only the _collection variables_ that you should be concerned about: ##### `base_url` The url of the environment that you want to interact with. ##### `client_id` The id of the client that will be reflected to all requests. ##### `since` The start date for apis that support date range filters. ##### `until` The end date for apis that support date range filters. ##### `comparison_since` The start date for apis that support date range comparison filters. ##### `comparison_until` The end date for apis that support date range comparison filters. ### Client-switching When changing the `client_id`, you also need to update other _variables_ as well (yext location, promio location, etc.) We extremely recommend that you never touch other _configuration variables_ at all. As mentioned earlier, there are a couple of api requests that will do it automatically for you. For example, if you wish to retrieve the first `yext_location_id` of a client, simply trigger **Get yext locations** request. The value of this configuration variable should be updated with the id of the first yext location in the response. ### Testing with Newman You may also install an npm package called [Newman](https://www.npmjs.com/package/newman) to run all api requests in our postman collection via cli. ```javascript npm install -g newman newman run surepulse-postman/surefire.postman_collection.json ``` > Note: Newman will use the *initial values* of your _configuration variables_ when initiating the tests, so make sure to double check these values especially `base_url` to avoid running these tests in production when not necessary. ### Contributing Please update [this repository](https://bitbucket.org/surepulse/surefire-postman/src/master/surefire.postman_collection.json) if you ever add, modified, removed any routes to surefire api. Head over to Postman then export your updated postman-collection using the recommended format (_Collection v2.1_ at the time of this writing) and commit this file to our bitbucket repository.