0

Web Write API - Postman Example (version 24)

The following article demonstrates how to set up an environment within Postman (v11.2.1) for testing Canary's web Write API. Postman is a platform designed for building and using API's. For more information on Postman and where to download it, visit https://www.postman.com/.

DISCLAIMER: The API requests found in this collection are configured to send data over the secure (https) Write API endpoint (55293) within the Store and Forward (SaF) service on the local machine.

Configuration

  1. Create an API token in the Identity service to be used for the ApiToken variable in Step 5. This could be the same token that the SaF service is configured to use if Tag Security is enabled.

  2. Open the Postman app and select Collections within the Workspaces page.

  3. Import the attached CanaryWebWriteAPIv24.postman_collection.json and Canary Web Write API v24.postman_environment files.

     
  4. Select the Canary Web Write API environment from the drop-down list.

  5. Open the Environment quick look menu to update the ApiToken variable. This token can be copied from the Identity tile>Security>API Tokens screen in the Canary Admin.

    Other variables may need updated depending on your environment.
     
  6. To test the connection, select the getSessionToken from the Collections list. A sessionToken is always needed when writing data to the Historian and includes an array of settings[]. A full list and description of these Session Settings can be found at writeapi.canarylabs.com. Select the Body tab to see the JSON message that will be passed in.

  7. Press Send. The call should return a Good status with a sessionToken string value.

  8. Once a sessionToken is acquired, it can be passed into functions, such as storeData, for writing values into the Historian.


    In this particular example, we are writing a value for tag1 and tag2 into the PostmanTest DataSet. The DataSet will be created automatically as the autoCreateDatasets setting is set to true in Step 6 when the sessionToken was generated.

Reply

null