Filtering data with the API

While working with the Replicon API, you may need to filter data. For example, you might want the API to return only projects that have a status of “In Progress” and whose names include the letter “a”.

You'll need to use our list services (e.g. ProjectListService1.svc, which is distinct from ProjectService1.svc) to filter data.

There is no one-to-one filter syntax in Replicon (i.e. name=’my project’); to filter data, you’ll need to build an expression tree using JSON, defining the operator that acts between the left and right expression in the tree.

You can visualize the example mentioned above using an abstract syntax tree:

 

The filter parameter for this example would look something like this:

{

   "page":"1",

   "pagesize":"100",

   "columnUris":[

      "urn:replicon:project-list-column:name"

   ],

   "sort":[

 

   ],

   "filterExpression":{

      "operatorUri":"urn:replicon:filter-operator:and",

      "leftExpression":{

         "operatorUri":"urn:replicon:filter-operator:equal",

         "leftExpression":{

            "filterDefinitionUri":"urn:replicon:project-list-filter:status"

         },

         "rightExpression":{

            "value":{

               "uri":"urn:replicon:project-status-type:in-progress"

            }

         }

      },

      "rightExpression":{

         "operatorUri":"urn:replicon:filter-operator:text-search",

         "leftExpression":{

            "filterDefinitionUri":"urn:replicon:project-list-filter:name"

         },

         "rightExpression":{

            "value":{

               "text":"a"

            }

         }

      }

   }

}

You can look up the available column and filterDefinition URIs using the filter lookup operations on each reference page that includes list services, in the Filter operations section. The operator URI options are also listed there.