> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Filtering

> Use OData filtering to retrieve specific sets of resources from the CData Arc Admin API.

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:

| Operator | Description |
| - | - |
| **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')`: returns only resources where the specified property begins with the specified value
* `endswith(property, 'value')`: returns only resources where the specified property ends with the specified value
* `contains(property, 'value')`: returns only resources where 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`

### Selecting Connector-Type-Specific Properties

The default OData response format only returns properties declared in the connector's resource schema (such as `connectorid`, `workspaceid`, and `connectortype`). Connector-type-specific properties (such as `as2identifier` for AS2 connectors, `url` for AS2 and HTTP connectors, or `remotehost` for SFTP connectors) are not declared in the schema and are silently omitted when `$select` is used with the default format.

To include connector-type-specific properties in a `$select` query, add `@json` to the request:

`GET http://mydomain.com:8001/api.rsc/connectors?@json&$select=connectorid,as2identifier`

When a connector-type-specific property is not applicable to a given connector type, it is absent from that connector's row in the response. This is expected behavior, not an error. For example, `as2identifier` appears in AS2 connector rows but is omitted for SFTP or FTP connectors.

You can combine standard and connector-type-specific properties in the same `$select` list:

`GET http://mydomain.com:8001/api.rsc/connectors?@json&$select=connectorid,workspaceid,as2identifier`

## 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`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.