フィルタリング

Version 23.4.8841


フィルタリング

Version 23.4.8841


The Admin API supports OData filtering to retrieve specific sets of Resources. OData filters are set as the ‘$filter’ query parameter in the target URL. The following logical operators can be used to build OData filters:

  • eq Equal to
  • ne Not equal to
  • gt Greater than
  • ge Greater than or equal to
  • lt Less than
  • le Less than or equal to
  • not Negation

For example, the following API request would use gt to retrieve Transaction Log metadata for all transactions after August 26th, 2019:

GET http://mydomain.com:8001/api.rsc/transactions?$filter=timestamp gt 2019-08-26

OData filters can be combined with the and and or keywords. For example, the following API request would retrieve all Transaction Log metadata for a specific connector’s transactions after August 26th, 2019:

http://mydomain.com:8001/api.rsc/transactions?$filter=timestamp gt 2019-08-26 and connectorid eq myConnector

The Admin API also supports the following functions inside of an OData filter:

  • startswith(property, ‘value’)—resources will only be returned if the specified property begins with the specified value
  • endswith(property, ‘value’)—resources will only be returned if the specified property ends with the specified value
  • contains(property, ‘value’)—resources will be only be returned if the specified property contains the specified value

For example, the following API request retrieves Transaction Log metadata for all XML files processed by the application:

GET http://mydomain.com:8001/api.rsc/transactions?$filter=contains(filepath,'.xml')

Selecting Specific Fields

In addition to the $filter query parameter, the $select query parameter can be set to limit the specific fields that are returned in the response. This parameter should be set to a comma-delimited list of the properties to retrieve. For example, the following API request retrieves the name and workspace of each configured connector, but none of the other configuration details of these connectors:

GET http://mydomain.com:8001/api.rsc/connectors?$select=connectorid,workspace

The API also supports retrieving a single value from a single resource. For example, the following API request returns the workspace for a specific connector:

http://localhost:8001/api.rsc/connectors('myConnector')/workspace/$value

Ordering

In addition to $filter and $select, the $orderby query parameter can be set to sort results into a specific order. This parameter is specified with the following syntax:

$orderby=columnName sortDirection

Where columnName is the column to use for sorting (e.g. filename, connectorId, timestamp) and sortDirection is either asc for ascending or desc for descending.

For example, the following API request retrieves Transaction Log metadata for all XML files processed by the application, then groups the results according to whether the files were sent or received:

GET http://mydomain.com:8001/api.rsc/transactions?$filter=contains(filepath,'.xml')&$orderby=status asc

Multiple ordering conditions can be specified by setting the $orderby parameter to a comma-delimited list. Conditions earlier in the list take precedence over conditions later in the list. For example, the following API request retrieves the same data as the previous request, but within the sent or received groups, the files are listed from largest to smallest:

GET http://mydomain.com:8001/api.rsc/transactions?$filter=contains(filepath,'.xml')&$orderby=status asc, filesize desc