Need "contains" searches when searching for users

Hi there,

The Users API is pretty good for what I need with my custom app, however my app is really simple and I don’t have a backend database for it. I have a property on the user schema called “topics” and I use it to store a space-delimited set of strings (the user tells us what topics they want to know more about, it’s a simple email collection app for a marketing campaign). It would be really great if I could do a “contains” search, since this data is unstructured.

Thanks!

Have you checked out Searching Arrays? You can search for a nested topic using the search param.

For example:

curl -v -X GET \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SSWS ${api_token}" \
"https://${org}.okta.com/api/v1/users?search=profile.topics+eq+\"topic1\" "

Will return all Users with topic1.

[
    {
        "id": "00u19uiKQa0xXkbdGLNR",
        "status": "PROVISIONED",
        "created": "2016-03-15T04:21:51.000Z",
        "activated": "2016-03-15T04:21:52.000Z",
        "statusChanged": "2016-03-15T04:21:52.000Z",
        "lastLogin": null,
        "lastUpdated": "2016-03-17T07:08:15.000Z",
        "passwordChanged": null,
        "profile": {
            "login": "login@example.com",
            "mobilePhone": null,
            "email": "email@example.com",
            "secondEmail": "",
            "firstName": "First",
            "lastName": "Last",
            "topics": [
                "topic1",
                "topic2"
            ]
        },
        "credentials": {
            "provider": {
                "type": "OKTA",
                "name": "OKTA"
            }
        },
        "_links": {
            "self": {
                "href": "http:/${org}.okta.com/api/v1/users/00u19uiKQa0xXkbdGLNR"
            }
        }
    }
]