Filtering
You can filter results returned from the API using a standard URI format.
Note
You can only filter on base object attributes. Filtering through non-base attributes is not supported and returns everything.
You can use multiple filter conditions in a single request. For example:
/products?filter=eq(ConfigurationType:'Standalone')&filter=eq(Active:true)
Info
Multiple conditions can be combined using the logical operator
AND
. The results returned only match ALL criteria specified in the request.
Operator | Description |
---|---|
eq | Equals. Checks if the values of two operands are equal. If they are, the condition is true. |
like | Like. Checks if the operand contains the specified string. Wildcards are supported. |
gt | Greater than. Checks if the value of the first operand is greater than that of the second. If they are, the condition is true. |
ge | Greater than or equal to. Checks if the value of the first operand is greater than or equal to that of the second. If they are, the condition is true. |
lt | Less than. Checks if the value of the first operand is less than that of the second. If they are, the condition is true. |
le | Less than or equal to. Checks if the value of the first operand is less than or equal to that of the second. If they are, the condition is true. |
in | In. Checks if the operand is contained in the specified string value. |
noteq | Not Equal. Checks if the value of two operands are equal. If they are not, the condition is true. |
notin | Not In. Checks if the operand is not contained in the specified string value. |
Passing an incorrectly formatted filter or using an unsupported operator returns a 400
response with the following error:
{
"errors": [
{
"Title": "Bad Request",
"Detail": "Could not parse the supplied filter",
"Source" : "client",
"Link" : "https://support.conga.com"
}
]
}
Supported Characters
As filters are passed as URL query string parameters, we must ensure all filters are URL safe and are strict about the characters that can be used in a filter.
Characters | Can be used in filter? |
---|---|
A-Z (upper & lower case) | Yes |
0-9 | Yes |
$ - _ * . ' | Yes |
(Space) | Yes (an unencoded + is also treated as a space). |
+ | Only when URL encoded (%2B ). |
Passing unsupported characters returns a 400
response with the following error:
{
"errors": [
{
"Title": "Bad Request",
"Detail": "The supplied filter contained unsupported characters",
"Source" : "client",
"Link" : "https://support.conga.com"
}
]
}
Supported Date Formats
Specify the date in yyyy-mm-dd format, for example 2022-04-27
. You can also specify the date as an integer number of milliseconds since 1970-01-01 00:00:00, also known as Unix epoch time. For example, 640912546584
.
URL Encoding Filters
We recommend URL encoding filters. For ease of use, you can encode the full filter, so filter=eq(ConfigurationType:'Standalone')
becomes filter=eq%28ConfigurationType%3A%27Standalone%27%29
.
Examples
Example: The eq
operator
eq
operatorIn the following example, we request all standalone products from the catalog by encoding the following filter:
filter=eq(ConfigurationType:'Standalone')
curl --request GET \
--url 'https://rlp-dev.congacloud.io/api/revenue-admin/v1/products?filter=eq%28ConfigurationType%3A%27Standalone%27%29'
fetch('https://rlp-dev.congacloud.io/api/revenue-admin/v1/products?filter=eq%28ConfigurationType%3A%27Standalone%27%29', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Example: The like
operator
like
operatorIn the following example, we request all products from the catalog that start with Conga
by encoding the following filter:
filter=like(Name:'Conga*')
curl --request GET \
--url 'https://rlp-dev.congacloud.io/api/revenue-admin/v1/products?filter=like%28Name%3A%27Conga%2A%27%29'
fetch('https://rlp-dev.congacloud.io/api/revenue-admin/v1/products?filter=like%28Name%3A%27Conga%2A%27%29', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Example: The in
operator
in
operatorIn the following example, we request all price list items in a price list that have a per-unit or tiered-rate price method by encoding the following filter:
filter=in(PriceMethod:'Per Unit','Tiered Rate')
curl --request GET \
--url 'https://rlp-dev.congacloud.io/api/revenue-admin/v1/price-lists/1234/prices?filter=in%28PriceMethod%3A%27Per%20Unit%27%2C%27Tiered%20Rate%27%29'
fetch('https://rlp-dev.congacloud.io/api/revenue-admin/v1/price-lists/1234/prices?filter=in%28PriceMethod%3A%27Per%20Unit%27%2C%27Tiered%20Rate%27%29', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Example: Chaining the ge
and le
operators
ge
and le
operatorsIn the following example, we request all price lists with an effective date on or after January 1, 2022 and an expiration date on or before December 31, 2022.
filter=ge(EffectiveDate:'2022-01-01T05:00:00.000Z')&filter=le(ExpirationDate:'2022-12-31T05:00:00.000Z')
curl --request GET \
--url 'https://rlp-dev.congacloud.io/api/revenue-admin/v1/price-lists?filter=gte%28EffectiveDate%3A%272022-01-01T05%3A00%3A00.000Z%27%29&filter=lte%28ExpirationDate%3A%272022-12-31T05%3A00%3A00.000Z%27%29'
fetch('https://rlp-dev.congacloud.io/api/revenue-admin/v1/price-lists?filter=gte%28EffectiveDate%3A%272022-01-01T05%3A00%3A00.000Z%27%29&filter=lte%28ExpirationDate%3A%272022-12-31T05%3A00%3A00.000Z%27%29', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Updated 11 months ago