Skip to main content
Skip table of contents

Query and Subscription Filters

Queries and subscriptions available to users of the SICON OS GraphQL API provide multiple ways to filter data using operation arguments.

Filter arguments follow the naming convention: variableNameFilter, for example deviceInstanceWhere. Filters can be combined.

The available filters are:

  • Skip

  • Take

  • Where

  • OrderBy

Skip and Take

Skip and Take are both integer type inputs, which allow for paginated requests to be made to the server. Skip specifies the number of results to skip, and take, the number of results to return. For example to return results 21 to 30, we would skip 20 and take 10.

Where

Where operation filters are a group of filters that allow developers to return results that match specified conditions. Conditions can be built up using all available fields in a model.

For example to return the active state of the device instance with an id of “0”, we can use the deviceInstanceQuery, with the deviceInstanceWhere argument, and then specify that the filter should apply the condition: where “id” equals “0”.

Below this operation is shown in Apollo Explorer.

The conditions available depend on the type of data being used in the rule.

WhereInt - integer

  • equals: Int

  • gt: Int

  • gte: Int

  • in: [Int]

  • lt: Int

  • lte: Int

  • not: Int

  • notIn: [Int]

Where - String

  • contains: String

  • endsWith: String

  • equals: String

  • gt: String

  • gte: String

  • in: [String]

  • lt: String

  • lte: String

  • not: String

  • notIn: [String]

  • startsWith: String

Where - Date

  • equals: DateTime

  • gt: DateTime

  • gte: DateTime

  • in: [DateTime]

  • lt: DateTime

  • lte: DateTime

  • not: DateTime

  • notIn: [DateTime]

Where - Enum

  • Fields of type enum only accept certain values in the where clause.

OrderBy

OrderBy filters allow developers to set the order of return data by specifying conditions. Numeric and string type fields in the queried model can be used to form OrderBy conditions in combination with the enum input “asc” or “desc” - ascending order or descending order. For strings the order is determined alphabetically.

For example, here the deviceInstanceQuery is used to return all device instance IDs, ordered by ID:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.