0 Replies Latest reply on Sep 30, 2014 4:02 PM by sharmon RSS
    sharmon Creator

    Using the Axeda v2 REST Services to Create an Expression Rule

    I was recently asked how to use the Axeda v2 REST services to create an expression rule. I thought this was a good opportunity to show how to use the REST services in general, so I created a short "explainer" video.

     

    If you're creating and managing expression rules, it's preferable to do it using Artisan. You can source-control your expression rules along with the rest of your domain objects, and deploying rules from one environment (say, sandbox) into another (say, QA or production), is just a matter of editing some Artisan properties files and redeploying. You could also write a Groovy-based custom object, and use the v2 API from there.

     

    However - your use case may call for the use of Axeda's v2 REST services, so here's how to use them:

     

     

    This is the body of the PUT request I sent in the video:

     

    <?xml version="1.0" encoding="UTF-8"?>
    <ExpressionRule xmlns="http://www.axeda.com/services/v2">
      <name>SMH_TestExpressionRule</name>
      <type>DATA</type>
      <description>This is a test expression rule</description>
      <ifExpression>true</ifExpression>
      <thenExpression>abs(1)</thenExpression>
      <elseExpression>Now()</elseExpression>
      <consecutive>true</consecutive>
      <applyToAll>false</applyToAll>
      <enabled>false</enabled>
      <standalone>true</standalone>
      <associatedModels>
      <!-- <model systemId="82"/> -->
      </associatedModels>
      <includedAssets>
      <!--
      <asset systemId="446"/>
      <asset systemId="447"/>
      -->
      </includedAssets>
      <excludedAssets>
      <!--
      <asset systemId="448"/>
      -->
      </excludedAssets>
    </ExpressionRule>
    
    

     

    Here are some of the URLs from the video:

     

    The reference I use is the Axeda v2 API-Servies DeveloperReference Guide_6.8, which is available in the documentation section of the Support Portal.