Aller au contenu

Filtering

Ce contenu n’est pas encore disponible dans votre langue.

scimply includes a recursive-descent filter parser that implements the full RFC 7644 ABNF grammar. Filters are parsed server-side and passed to the store as a resource.FilterExpression.

GET /scim/v2/Users?filter=<expression>
OperatorExampleDescription
equserName eq "bjensen"Equal
neactive ne falseNot equal
coemails.value co "@example.com"Contains
swuserName sw "b"Starts with
ewuserName ew "sen"Ends with
gtmeta.lastModified gt "2024-01-01T00:00:00Z"Greater than
gemeta.lastModified ge "2024-01-01T00:00:00Z"Greater than or equal
ltmeta.lastModified lt "2024-01-01T00:00:00Z"Less than
lemeta.lastModified le "2024-01-01T00:00:00Z"Less than or equal
prphoneNumbers prAttribute is present
GET /scim/v2/Users?filter=active eq true and userType eq "Employee"
GET /scim/v2/Users?filter=active eq true or userType eq "Contractor"
GET /scim/v2/Users?filter=not (userName eq "bjensen")

Value path filters (attribute sub-filters)

Section titled “Value path filters (attribute sub-filters)”

Use square brackets to filter within a multi-valued attribute:

GET /scim/v2/Users?filter=emails[type eq "work" and value co "@example.com"]
GET /scim/v2/Groups?filter=members[value eq "user-123"]

For long or complex filters, use the .search endpoint to avoid URL length limits:

Terminal window
POST /scim/v2/Users/.search
Content-Type: application/scim+json
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:SearchRequest"],
"filter": "emails[type eq \"work\"] and active eq true",
"sortBy": "userName",
"sortOrder": "ascending",
"startIndex": 1,
"count": 50
}
GET /scim/v2/Users?sortBy=userName&sortOrder=ascending&startIndex=1&count=25

startIndex is 1-based. The response includes totalResults, startIndex, and itemsPerPage.

The server parses the filter into a resource.FilterExpression and passes it via store.ListParams.Filter. Stores that cannot push the filter to the database may set ListResult.NeedsClientFilter = true — the server will then apply the filter in-process using the built-in evaluator.