Post Block Example

In this example of how to use the Post Workflow block, we are using the IPFusion API to send a command to an asset. For more information about the IPFusion API, see the API topic.

Before starting, you must have:
  • A Workflow with a Post Block added
  • A trigger defined
  • At least one asset which has the Mask command defined in its command table (in our example we use an IPFusion OPC asset)
  • The API is enabled for the Workstation this Workflow will run on

To configure the Post block to send a Mask command to an asset:

  1. Double-click the Post block to be configured, this opens the Post Editor.
  2. In the URL field, we are entering the URL for the POST command. In this case it will be http://localhost:8080/ipfusion/Assets/1/Command where the "1" is the asset ID for our asset which the command is being executed on. Further information about this command can be viewed in the Asset API Commands topic.
    URL field with required value entered.
  3. In the Header section, we are entering all of the required headers for the Post request. Multiple headers can be added. Our command will only require one header, which will specify the format we are using for the Post request variables:
    1. Set the Name to Content-Type.
    2. Set the Value to application/json.
    Header field with required entry added.
  4. In the Post field, we are entering the variables which contain the information required for the command we are sending to the API. In the previous step, we specified the format as being JSON. The value to be entered here is {"commandName":"Mask"} where "Mask" is the name of the asset command as specified within its command table.
    Note: The Insert Variable button may be used to insert project variable values directly into the POST request. The variables available here are all those which are available within the Logic Editor.
    Post field with required JSON object added.

When this Workflow is triggered, the specified asset will have a Mask command sent to it via the API.