Master Data Management with webMethods OneData : Developing for webMethods OneData : REST Web Services : Using Filters in REST Services : Using Filter Operators in a REST URL
Using Filter Operators in a REST URL
You can retrieve specific records by adding a filter to the basic REST URL, as described in Using Filter Operators in a REST URL. To add a filter, append the filter parameter to the REST URL, as ?filter.
And and Or Operators
OneData supports either and or or operators in the REST URL. To use a combined and and or condition, you must use a JSON string. For more information about JSON strings, see Using JSON Strings in REST Services.
*and. The and operator returns results that satisfy all filter conditions, as in COL1=value1 and COL2=value2. For example, the syntax for a URL would be:
http://localhost:8080/onedata/rest/QA/Standard%20Project/DO/REST_FILTER_OBJECT?filter=ID=3 and COL1=2.
*or. The or operator returns results satisfying one of the filter conditions, as in COL1=value1 or COL2=value2. For example, the syntax for a URL would be:
http://localhost:8080/onedata/rest/QA/Standard%20Project/DO/REST_FILTER_OBJECT?filter=ID=3 or COL1=2.
Comparison Operators
OneData supports the comparison operators IS_NULL, IS_NOT_NULL, EQUAL, and LIKE in REST URLs. To use the IN comparison, you must use a JSON string.
You can compare values within columns.
*IS_NULL. Returns results where the value the column is null, as COL1&nullOperator=IS_NULL. The syntax would be:
http://localhost:8080/onedata/rest/QA/Standard%20Project/DO/REST_FILTER_OBJECT?filter=ID or COL1&nullOperator=IS_NULL.
*IS_NOT_NULL. Returns results where the value the column is not null, as COL1&nullOperator=IS_NOT_NULL. The syntax would be:
COL1 and COL2&nullOperator=IS_NOT_NULL
COL1 or COL2&nullOperator=IS_NOT_NULL
Record Values and Data Type Syntax
The following table describes the syntax to use for record values based on the data type of the column.
Data Type of Column
Syntax
Numeric
Specify the value as is, without quotes. EMPLOYEE_ID=120. Where Brand_ID is 1, the URL would be:
http://localhost:8080/onedata/rest/QA/StandardProject/DO/Brand
?filter=Brand_Id=1
String
Wrap the value in double quotes. EMPLOYEE_NAME=”John Doe” Where Brand_ID is 1 and Brand_Type is Electronics, the URL would be:
http://localhost:8080/onedata/rest/QA/StandardProject/DO/Brand
?filter=Brand_Id=1 and Brand_Type="Electronics"
Date
Wrap in double quotes, in the format YYYY-MM-DD. Treated as a string. EMPLOYEE_DOB=”1984-12-31”
Timestamp
Wrap the value in double quotes, in the format YYYY-MM-DD HH:MM:SS.sssssssss. Treated as a string. You must specify at least one digit in the milliseconds (sssssssss).EMPLOYEE_DOJ=”2007-03-01 10:30:30.0.”
Special Characters
Prefix with backslash characters. The standard is as specified in http://www.w3.org/Addressing/URL/uri-spec.html.
*Address H-12, O'Brian Ave, California would be, EMPLOYEE_ADDRESS=”H-12, O'Brian Ave, California”
*Address Manor “Gate” California would be, EMPLOYEE_ADDRESS=”Manor \”Gate\”, California”
Conceptual Object Filters
To filter child records in a conceptual object, the syntax is filter=<Parent Object Name>.<Child Object Name>.<Field Name>=VALUE
For example, the Location conceptual object consists of Country (parent object), and State and City as child objects. To retrieve the data from the conceptual object, Location, in which Country_Name is Country1, the URL would be:
http://localhost:8080onedata/rest/QA/StandardProject/CO/Location
?filter=Country_Name="USA"
To retrieve the data from conceptual object Location in which State_Name is Colombo, the URL would be:
http://localhost:8080/onedata/rest/QA/StandardProject/CO/Location
?filter=Country.State.State_Name="Colombo"
Copyright © 2011-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback