# Search for dSources.

Endpoint: POST /dsources/search
Version: 3.17.0
Security: ApiKeyAuth

## Security:

  - `ApiKeyAuth` (unknown)
    apiKey in header Authorization

## Query parameters:

  - `limit` (integer)
    Maximum number of objects to return per query. The value must be between 1 and 1000. Default is 100.

  - `cursor` (string)
    Cursor to fetch the next or previous page of results. The value of this property must be extracted from the 'prev_cursor' or 'next_cursor' property of a PaginatedResponseMetadata which is contained in the response of list and search API endpoints.

  - `sort` (string)
    The field to sort results by. A property name with a prepended '-' signifies descending order.

  - `permission` (string)
    Restrict the objects, which are allowed.

## Request body:

  - `application/json` (unknown)
    A request body containing a filter expression. This enables searching
for items matching arbitrarily complex conditions. The list of
attributes which can be used in filter expressions is available
in the x-filterable vendor extension.
# Filter Expression Overview
**Note: All keywords are case-insensitive**
## Comparison Operators
| Operator | Description | Example |
|  --- | --- | --- |
| CONTAINS | Substring or membership testing for string and list attributes respectively. | field3 CONTAINS 'foobar', field4 CONTAINS TRUE |
| IN | Tests if field is a member of a list literal. List can contain a maximum of 100 values | field2 IN ['Goku', 'Vegeta'] |
| GE | Tests if a field is greater than or equal to a literal value | field1 GE 1.2e-2 |
| GT | Tests if a field is greater than a literal value | field1 GT 1.2e-2 |
| LE | Tests if a field is less than or equal to a literal value | field1 LE 9000 |
| LT | Tests if a field is less than a literal value | field1 LT 9.02 |
| NE | Tests if a field is not equal to a literal value | field1 NE 42 |
| EQ | Tests if a field is equal to a literal value | field1 EQ 42 |

## Search Operator
The SEARCH operator filters for items which have any filterable
attribute that contains the input string as a substring, comparison
is done case-insensitively. This is not restricted to attributes with
string values. Specifically `SEARCH '12'` would match an item with an
attribute with an integer value of `123`.
## Logical Operators
Ordered by precedence.
| Operator | Description | Example |
|  --- | --- | --- |
| NOT | Logical NOT (Right associative) | NOT field1 LE 9000 |
| AND | Logical AND (Left Associative) | field1 GT 9000 AND field2 EQ 'Goku' |
| OR | Logical OR (Left Associative) | field1 GT 9000 OR field2 EQ 'Goku' |

## Grouping
Parenthesis `()` can be used to override operator precedence.
For example:
NOT (field1 LT 1234 AND field2 CONTAINS 'foo')
## Literal Values
| Literal | Description | Examples |
|  --- | --- | --- |
| Nil | Represents the absence of a value | nil, Nil, nIl, NIL |
| Boolean | true/false boolean | true, false, True, False, TRUE, FALSE |
| Number | Signed integer and floating point numbers. Also supports scientific notation. | 0, 1, -1, 1.2, 0.35, 1.2e-2, -1.2e+2 |
| String | Single or double quoted | "foo", "bar", "foo bar", 'foo', 'bar', 'foo bar' |
| Datetime | Formatted according to [RFC3339](https://datatracker.ietf.org/doc/html/rfc3339) | 2018-04-27T18:39:26.397237+00:00 |
| List | Comma-separated literals wrapped in square brackets | [0], [0, 1], ['foo', "bar"] |

## Limitations
- A maximum of 8 unique identifiers may be used inside a filter expression.

## Request fields (application/json):

  - `filter_expression` (string)
    Example: string_field CONTAINS "over" AND numberic_field GT 9000 OR string_field2 EQ "Goku"

## Request examples:

  - `Nested Object Comparison` (unknown)
    An example of a nested Object comparison testing that at least one repository has a
version which is equal to 19.0.0.

  - `Relative comparison` (unknown)
    An example of a relative comparison testing that field1 has a
value which is less than 123.

  - `Absence of an attribute value` (unknown)
    An example of using nil to test for the absence of a value for field2.

  - `Existence of an attribute value` (unknown)
    An example of using nil to test for the existence of a value for field2.

  - `Use of the CONTAINS operator` (unknown)
    An example of using the 'CONTAINS' operator to check if
field2 contains the string 'foo'. If field2 is string valued
then this is checking if 'foo' is a substring of field2. If
field2 is a list of strings then this is checking if 'foo'
is a member of the list.

  - `Use of the IN operator` (unknown)
    An example of using the 'IN' operator to check if field1
is an element of a list literal.

  - `Use of the SEARCH operator` (unknown)
    An example of using the 'SEARCH' operator to retrieve all elements
for which 'foo' is a substring of a filterable attribute.

  - `Overriding operator precedence` (unknown)
    An example of parenthesis being used to group operators & override
operator precedence.

## Response 200:

  - `200` (unknown)
    OK

## Response 200 fields (application/json):

  - `items` (array)

  - `items.id` (string)
    The dSource object entity ID.

  - `items.database_type` (string)
    The database type of this dSource.

  - `items.name` (string)
    The container name of this dSource.

  - `items.namespace_id` (string)
    The namespace id of this dSource.

  - `items.namespace_name` (string)
    The namespace name of this dSource.

  - `items.is_replica` (boolean)
    Is this a replicated object.

  - `items.database_version` (string)
    The database version of this dSource.

  - `items.content_type` (string)
    The content type of the dSource.

  - `items.data_uuid` (string)
    A universal ID that uniquely identifies the dSource database.

  - `items.storage_size` (integer)
    The actual space used by this dSource, in bytes.

  - `items.plugin_version` (string)
    The version of the plugin associated with this source database.

  - `items.creation_date` (string)
    The date this dSource was created.

  - `items.group_name` (string)
    The name of the group containing this dSource.

  - `items.enabled` (boolean)
    A value indicating whether this dSource is enabled.

  - `items.is_detached` (boolean)
    A value indicating whether this dSource is detached.

  - `items.engine_id` (string)
    A reference to the Engine that this dSource belongs to.

  - `items.source_id` (string)
    A reference to the Source associated with this dSource.

  - `items.status` (string)
    The runtime status of the dSource. 'Unknown' if all attempts to connect to the source failed.

  - `items.engine_name` (string)
    Name of the Engine where this DSource is hosted

  - `items.cdb_id` (string)
    A reference to the CDB associated with this dSource.

  - `items.current_timeflow_id` (string)
    A reference to the currently active timeflow for this dSource.
    Example: timeflow-123

  - `items.previous_timeflow_id` (string)
    A reference to the previous timeflow for this dSource.
    Example: timeflow-123

  - `items.is_appdata` (boolean)
    Indicates whether this dSource has an AppData database.
    Example: true

  - `items.toolkit_id` (string)
    The ID of the toolkit associated with this dSource(AppData only).

  - `items.unvirtualized_space` (integer)
    This is the sum of unvirtualized space from the dependants VDBs of the dSource.

  - `items.dependant_vdbs` (integer)
    The number of VDBs that are dependant on this dSource. This includes all VDB descendants that have this dSource as an ancestor.

  - `items.tags` (array)

  - `items.tags.key` (string, required)
    Key of the tag
    Example: key-1

  - `items.tags.value` (string, required)
    Value of the tag
    Example: value-1

  - `items.primary_object_id` (string)
    The ID of the parent object from which replication was done.

  - `items.primary_engine_id` (string)
    The ID of the parent engine from which replication was done.

  - `items.primary_engine_name` (string)
    The name of the parent engine from which replication was done.

  - `items.replicas` (array)
    The list of replicas replicated from this object.

  - `items.replicas.replica_id` (string)
    The ID of the replicated object.
    Example: replica-1

  - `items.replicas.replica_engine_id` (string)
    The ID of the replicated object's engine.
    Example: 1

  - `items.replicas.replica_engine_name` (string)
    The name of the replicated object's engine.
    Example: replica-e1

  - `items.replicas.replica_namespace_id` (string)
    The namespace id of the replicated object.
    Example: namespace-1

  - `items.hooks` (object)
    DSource operation hooks.

  - `items.hooks.ops_pre_sync` (array)
    The commands to execute before syncing with external data.

  - `items.hooks.ops_pre_sync.name` (string)
    Example: Print the current user

  - `items.hooks.ops_pre_sync.command` (string, required)
    Example: whoami

  - `items.hooks.ops_pre_sync.shell` (string)
    Enum: "bash", "shell", "expect", "ps", "psd"

  - `items.hooks.ops_pre_sync.element_id` (string)
    Example: 0

  - `items.hooks.ops_pre_sync.has_credentials` (boolean)
    Example: false

  - `items.hooks.ops_pre_log_sync` (array)
    The commands to execute after syncing with external data and before running the LogSync.

  - `items.hooks.ops_post_sync` (array)
    The commands to execute after syncing a linked source.

  - `items.hooks.pre_validated_sync` (array)
    The commands to execute on the staging source before performing a validated sync.

  - `items.hooks.post_validated_sync` (array)
    The commands to execute on the staging source after performing a validated sync.

  - `items.sync_policy_id` (string)
    The id of the snapshot policy associated with this dSource.

  - `items.retention_policy_id` (string)
    The id of the retention policy associated with this dSource.

  - `items.replica_retention_policy_id` (string)
    The id of the replica retention policy associated with this dSource.

  - `items.quota_policy_id` (string)
    The id of the quota policy associated with this dSource.

  - `items.logsync_enabled` (boolean)
    True if LogSync is enabled for this dSource.

  - `items.exported_data_directory` (string)
    ZFS exported data directory path.

  - `items.template_id` (string)
    A reference to the Non Virtual Database Template.
    Example: DATABASE_TEMPLATE-1

  - `response_metadata` (object)

  - `response_metadata.prev_cursor` (string)
    Pointer to the previous page of results. Use this value as a cursor query parameter in a subsequent request, along with limit, to navigate through the collection by virtual page.

  - `response_metadata.next_cursor` (string)
    Pointer to the next page of results. Use this value as a cursor query parameter in a subsequent request, along with limit, to navigate through the collection by virtual page.

  - `response_metadata.total` (integer)
    The total number of results. This value may not be provided.

